Ex05 – Button with more than one LEDs

oweek_e05

Controlling two LEDs with separate button (parallel).

void setup()   {
   pinMode(1, OUTPUT); // initialize the digital pin as an output:
   pinMode(8, OUTPUT); // initialize the digital pin as an output:
}

void loop() {
   digitalWrite(1, HIGH);    // set the LED on
   digitalWrite(8, HIGH);    // set the LED on
}

Controlling two LEDs with the same button (in series).

void setup()   {
   pinMode(8, OUTPUT); // initialize the digital pin as an output:
}

void loop() {
   digitalWrite(8, HIGH);    // set the LED on
}