Blinking various LEDs using Arrays

We have already discussed how to blink a single LED, two LEDs, and LEDs using a loop, in previous topics.

Here, we will discuss a project to blink five LEDs using array. All the five LEDs will light one after the other.

Hardware Required

The components required for the project are listed below:

  • 5 x red LED
  • 5 x 220 Ohm Resistors
  • Arduino UNO R3 board
  • Jump wires

We can use any color LED as per our choice.

Principle

We will connect the five LEDs to pins 13, 12, 8, 4, and 2 of the Arduino board. The required resistance of the resistors is enough to light up an LED without damaging the board and other components.

The LED arranged one after another will light up. We can also change or rearrange the LEDs connected to the specified pin number on the board.

Structure of the project

The structure clearly shows the UNO board's pinout, and the five LEDs with resistors in series are connected to the board.

It is shown below:

Blinking various LEDs using Arrays

Connection

The connection of the above project is discussed below:

  • Connect the resistor of 220 Ohm in series with the five LEDs. Now connect it to the pin number 13, 12, 8, 4, and 2 of the Arduino board.
  • Connect the negative terminal of the five LEDs to the GND (Ground).

Sketch

The code to light the five LEDs is given below:

Connection Diagram

We will show the connection using the Simulator because the connections become clearer and more precise.

We can make the same connection using the hardware devices.

Blinking various LEDs using Arrays