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 :-
- Arduino Uno
- jumper wires
- 3 x 330 ohm resistors
- 3 x LED’s
- Arduino IDE pre-installed in your PC
How to assemble the circuit :-
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:
// initialize the digital pins 13,12 and 11 as output.
// the code inside the loop routine runs over and over again forever:
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
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.