How to Blink Multiple LEDs with Arduino

This Article shows the simplest thing you can do with an Arduino Uno or Genuino Uno to see the physical output: it blinks the multiple LEDs.

Hardware Required:

  1. Arduino UNO
  2. LEDs Three

Circuit:

This example uses the blinking LEDs by Arduino UNO/Nano. These LEDs are connected to digital pins.If you want to lit LEDs follow the steps below:

  1. Connect the Positive pins of LED to digital pins of Arduino UNO.
  2. In this example, we are connecting LEDs positive terminal to Digital pins of Arduino UNO 9,10,11.
  3. Connect the ground to a common ground.

Circuit Diagram:

Code:

After you build the circuit plug your Arduino or Genuino board into your computer, start the Arduino Software (IDE) and enter the code below.

The first thing you do is to initialize digital pins as an output pin with the line

pinMode(9,OUTPUT);

pinMode(10,OUTPUT);

pinMode(11,OUTPUT);

As we are using the pins 9,10,11 we have declared the pins 9,10,11 as output.

In the main loop, you turn the LED on with the line:

digitalWrite(9,HIGH);

digitalWrite(10,HIGH);

digitalWrite(11,HIGH);

This supplies 5 volts to the LED anode. That creates a voltage difference across the pins of the LED, and lights it up. Then you turn it off with the line:

digitalWrite(9,LOW);

digitalWrite(10,LOW);

digitalWrite(11,LOW);

That takes the digitall pins back to 0 volts, and turns the LED off. In between the on and the off, you want enough time for a person to see the change, so the delay() commands tell the board to do nothing for 1000 milliseconds, or one second. When you use the delay() command, nothing else happens for that amount of time.

1
void setup() {
1
// initialize digital pin LED_BUILTIN as an output.
1
pinMode(9,OUTPUT);

pinMode(10,OUTPUT);

pinMode(11,OUTPUT);

}

// the loop function runs over and over again forever
void loop(){
digitalWrite(9,HIGH);

digitalWrite(10,HIGH);

digitalWrite(11,HIGH);/ turn the LED on (HIGH is the voltage level)
delay(1000);     // wait for a second
digitalWrite(9,LOW);

digitalWrite(10,LOW);

digitalWrite(11,LOW); // turn the LED off by making the voltage LOW
delay(1000);     // wait for a secon
}

 

 

Leave a Reply