Ex02 – Connecting in series

oweek_e02

Two or more LEDs can be controlled by one digital pin at the same time by connecting those LEDs in series. With a given resistance (a single resistance, i.e. 200ohm) and voltage supply (computer), the current for each LEDs gained will be reduced as the number of LEDs increase.

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

void loop() {
   digitalWrite(8, HIGH);   // set the LED on  
   delay(1000);                  // wait for a second
   digitalWrite(8, LOW);    // set the LED off
   delay(1000);                  // wait for a second (1000 milli seconds)
}