Alternate Blinkng of Multiple LED’s And Explanation of Code.

This example is just a variation of the blink example just this time I will blink three LED’s alternatively and explain the code which governs this experiment.

Hardware required :-

  1. Arduino Uno
  2. breadboard
  3. jumper wires
  4. 3 x 330 ohm resistors
  5. 3 x LED’s
  6. Arduino IDE pre-installed in your PC

How to assemble the circuit :-




int led1 = 13;
int led2 = 12;
int led3 = 11;
//by this we activated the pin 13,12 and 11
// the setup routine runs once when you press reset:
void setup()
// initialize the digital pins 13,12 and 11 as output.
  pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);

// the code inside the loop routine runs over and over again forever:
void loop()

digitalWrite(led1, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(100);               // wait for one-tenth of a second
digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
{digitalWrite(led2, HIGH);
digitalWrite(led2, LOW);
{digitalWrite(led3, HIGH);
digitalWrite(led3, LOW);
delay(100);}// wait for a second

 What you can vary in the code :-
The circuit that i assembled and the code given is for three led’s what you can do is to assemble the circuit for two led’s and write the code for alternate blinking of the two led’s. You can change the delay time of both the led’s and you may also change the delay of one led and keep the other same.
Prerequisite :-
You must be familiar with the blink program i created on the breadboard using a single LED. This will help you to set up the circuit by simply reading the code. I will strongly recommend to go through the older page where i created the program for a single LED before trying this one.
For more interesting variations in basic experiments follow my blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s