In previous tutorials, we have done with blinking one led with Arduino. Now its time to do little more – controlling multiple LEDs with Arduino.
An Arduino has enough pins to control multiple LEDs at once. In this tutorial, we will use 5 LEDs at once and control their blinking time simultaneously.
We execute two different codes on Arduino Uno and check their output.
LED is a semiconductor that emits light when passing through an electric current. Also called a light-emitting diode.
Here some more tutorials for you:
- Getting started with Arduino
- How to use an LCD Display with Arduino
- Arduino Generating Random Numbers
- LED Blinking Control by Potentiometer
- How to use an RGB LED with Arduino
Components List
- Arduino Uno
- LED’s
- Resistors (300Ω – 1 KΩ)
- Breadboard
- Jumper Wires
Connection with Arduino
Connect the following Arduino with LEDs respectively.
LEDs Leg | Arduino Pins |
---|---|
All LED Cathodes | GND |
RED Anode | D7 |
BLUE Anode | D6 |
ORANGE Anode | D5 |
GREEN Anode | D4 |
YELLOW Anode | D3 |
Always connect a resistor of 1KΩ with an LED. The bigger one wire of led is +ve and the other is -ve.
Circuit Diagram for Multiple LEDs with Arduino

Understand the circuit diagram given above, connecting the LEDs from the resistor and then the Arduino pins. Before connecting LEDs using breadboard you have the knowledge of how a breadboard works. Follow the above circuit diagram to controlling multiple LEDs with Arduino.
Code 1
Connect your Arduino with the computer and select the board name and port number. Now upload the below code.
The above sketch work in the following ways:
- Pin 7 becomes HIGH which turns on LED1.
- Wait 200ms.
- Pin 7 becomes LOW which turns off LED1.
- Wait 200ms.
- Pin 6 becomes HIGH which turns on LED2.
- Wait 200ms.
- Pin 6 becomes LOW which turns off LED2.
- Wait 200ms
- Now same as pin 5, 4, 3 works.
Output 1

Code 2
Now upload the below code to the Arduino. The below code has a different algorithm.
The above code work in the following way:
- Pin 7, 6, 5, 4 and 3 become HIGH which turns on all LEDs.
- Wait 200ms.
- Pin 7 becomes LOW which turns off LED1.
- Wait 200ms.
- Pin 6 becomes LOW which turns off LED2.
- Pin 7 becomes HIGH which turns on LED1.
- Wait 200ms.
- Pin 5 becomes LOW which turns off LED3.
- Pin 6 becomes HIGH which turns on LED2.
- Wait 200ms.
- Pin 4 becomes LOW which turns off LED4.
- Pin 5 becomes HIGH which turns on LED3.
- Wait 200ms.
- Pin 3 becomes LOW which turns off LED5.
- Pin 4 becomes HIGH which turns off LED4.
- Repeat from Step 1.
Output 2

Troubleshooting / Errors
- The LED’s inserted backward, so ensure that led’s big leg connected to +ve.
- LED’s burst problem. So the use of a resistor is mandatory.
- Wire connections may be loose.
You’ve seen how we control multiple LEDs with Arduino. Controlling multiple LEDs with Arduino is a very easy task and we can also add more LEDs and with different code algorithms. So now it’s your turn to make more awesome projects using Arduino and LEDs.
If you liked this article, then give us feedback. Share this article with the needy one. If you get any error then tell us your error by commenting