Introduction
When most people start learning Arduino, the first thing they try is blinking an LED. It may look very simple, but this small step is where everything begins.
I still remember the first time I made an LED blink. At that moment, it felt like I had actually controlled something using code. That’s when I understood how powerful Arduino can be.
In this tutorial, you will learn how to blink an LED using Arduino step by step. You will understand how to connect the circuit, write the code, and see the output in real time.
This example will also help you understand the basic working of Arduino programs, especially how the setup() and loop() functions control the behavior of your project.
If you have already gone through the Arduino Uno and Arduino IDE basics, this will be your first practical step. If not, you can still follow along and learn as you go.
Now, let’s start and make your first LED blink using Arduino.
What is LED Blink in Arduino?
LED blinking in Arduino simply means turning an LED ON and OFF repeatedly using code. It is one of the most basic ways to understand how Arduino controls electronic components.
At first, it may look like just a small light turning on and off. But behind that simple action, the Arduino is actually following instructions that you have written in the program.
In real life, this concept is used in many devices. For example, notification lights, power indicators, and warning signals all work using the same ON and OFF logic.
When I first tried this, I didn’t think it was a big deal. But once the LED started blinking exactly how I programmed it, I realized that I was actually controlling hardware using code. That’s when things started becoming interesting.
This is why the LED blink example is important. It helps you understand:
- How to control output devices
- How Arduino executes code
- How timing works using delays
Once you understand this concept, you can easily move on to more advanced projects like controlling motors, sensors, and automation systems.
Now that you know what LED blinking is, let’s look at the components required to build this circuit.
Components Required
To build this LED blinking circuit, you only need a few basic components. These are easily available and commonly used in most Arduino projects.
| Component | Quantity | Buy Link |
|---|---|---|
| Arduino Uno | 1 | {getButton} $text={Buy Now} $icon={cart} |
| LED | 1 | {getButton} $text={Buy Now} $icon={cart} |
| Resistor (220Ω) | 1 | {getButton} $text={Buy Now} $icon={cart} |
| Breadboard | 1 | {getButton} $text={Buy Now} $icon={cart} |
| Jumper Wires | 2-3 | {getButton} $text={Buy Now} $icon={cart} |
Make sure all components are properly connected before powering the circuit. Using the correct resistor value is important to avoid damaging the LED.
Arduino LED Blink Circuit
Before writing the code, we need to connect the circuit properly. This is a very simple setup and a great starting point for beginners.
When I first built this circuit, I realized how important correct connections are. Even a small mistake like reversing the LED can stop the circuit from working.
In this setup, we will connect an LED to the Arduino so that it can be controlled using code.
LED Connection
- Anode (+) → Connect to Digital Pin 13
- Cathode (-) → Connect to GND (through a resistor)
The resistor (220Ω) is used to limit the current and protect the LED from damage.
Circuit Diagram
Refer to the image below to understand the connections clearly:
Make sure the longer leg of the LED (anode) is connected to Pin 13, and the shorter leg (cathode) goes to GND through the resistor.
If your connections are correct, you are ready for the next step — writing the code to control the LED.
Arduino Blink LED Code
Now that the circuit is ready, let’s write the code to make the LED blink. This is the first program most beginners try, and it helps you understand how Arduino works.
Copy the code below and paste it into your Arduino IDE.
Code Explanation
Let’s understand this code line by line in a simple way.
setup() Function
The setup() function runs only once when the Arduino starts.
- pinMode(13, OUTPUT); → This sets pin 13 as an output pin, which means it will send signals to control the LED.
loop() Function
The loop() function runs continuously, again and again.
- digitalWrite(13, HIGH); → Turns the LED ON
- delay(1000); → Waits for 1 second (1000 milliseconds)
- digitalWrite(13, LOW); → Turns the LED OFF
- delay(1000); → Waits for 1 second again
Because the loop runs continuously, the LED keeps turning ON and OFF, which creates the blinking effect.
👉 Try changing the delay value (for example, 500) to make the LED blink faster.
How the Code Works
Now that you have written the code, let’s understand how it actually works inside the Arduino. This will help you not just copy the code, but really understand what is happening.
When I first learned this, I realized that Arduino is simply following instructions step by step, just like we tell it to do.
setup() Function
The setup() function runs only once when the Arduino board is powered ON or reset.
In our code:
- pinMode(13, OUTPUT); → This tells the Arduino that pin 13 will be used to send signals (output) to the LED.
This step is important because Arduino needs to know whether a pin is used for input or output.
loop() Function
The loop() function runs continuously after setup(). It keeps repeating again and again.
In this part:
- The LED is turned ON
- The program waits
- The LED is turned OFF
- The program waits again
Since this happens repeatedly, the LED keeps blinking.
delay() Concept
The delay() function is used to pause the program for a specific amount of time.
For example:
- delay(1000); means wait for 1000 milliseconds (1 second)
This delay is what controls how fast or slow the LED blinks.
👉 If you reduce the delay value, the LED will blink faster. 👉 If you increase it, the blinking will be slower.
Once you understand setup(), loop(), and delay(), you can control many other components like motors, sensors, and displays.
Arduino Blink Onboard LED
If you don’t have an external LED or want a quick test, Arduino Uno already has a built-in LED on the board. This makes it very easy for beginners to try their first program without connecting any extra components.
The onboard LED is connected internally to digital pin 13. So, when you write code for pin 13, you are directly controlling this built-in LED.
No External LED Needed
One of the easiest ways to test your Arduino setup is by using the onboard LED. You don’t need a breadboard, resistor, or wires.
Just upload the same blink code, and you will see the LED on the board start blinking.
Built-in LED (Pin 13)
The onboard LED is usually marked as "L" on the Arduino Uno board.
Since it is already connected to pin 13 internally, the same code works without any changes:
- digitalWrite(13, HIGH); → LED ON
- digitalWrite(13, LOW); → LED OFF
This is a great way to quickly check whether your Arduino board and code are working correctly.
Once you are comfortable with this, you can move on to using external components and building more advanced projects.
Multiple Blinking LED Arduino Code
Now that you have learned how to blink a single LED, let’s take it one step further and control two LEDs. This will help you understand how Arduino handles multiple outputs at the same time.
In this example, two LEDs will blink alternately — when one is ON, the other will be OFF.
Circuit Connection
- LED 1 Anode (+) → Pin 13
- LED 1 Cathode (-) → GND (through resistor)
- LED 2 Anode (+) → Pin 12
- LED 2 Cathode (-) → GND (through resistor)
Make sure each LED has its own resistor to avoid damage.
Circuit Diagram
Refer to the image below for better understanding:
Arduino Code
How This Works
In this code, we are controlling two LEDs using two different pins.
- First, LED 1 turns ON while LED 2 stays OFF
- After a short delay, LED 1 turns OFF and LED 2 turns ON
This process repeats continuously, creating an alternating blinking effect.
👉 Try changing the delay value to see different blinking speeds.
This is a simple way to understand how multiple outputs can be controlled using Arduino.
Common Mistakes
When you are starting with Arduino, it is very common to face small issues. Sometimes the LED doesn’t blink, and you may think something is wrong with the board or code. But in most cases, the problem is very simple.
Let’s look at some common mistakes and how to avoid them.
Wrong LED Polarity
LEDs have two legs:
- Long leg (Anode +)
- Short leg (Cathode -)
If you connect the LED in the wrong direction, it will not glow at all.
👉 Always connect:
- Anode → Arduino pin
- Cathode → GND (through resistor)
No Resistor
Many beginners skip using a resistor, but this can damage the LED.
A resistor (usually 220Ω) limits the current flowing through the LED and protects it.
👉 Always use a resistor in series with the LED.
Wrong Pin Connection
If your code is written for pin 13 but you connect the LED to another pin, it will not work.
👉 Make sure:
- Pin number in code matches your circuit
- Connections are properly inserted
Most problems can be solved by checking these simple things. Once you fix them, your LED should start blinking correctly.
Applications of LED Blink
At first, blinking an LED may look like a very basic task. But this simple concept is actually used in many real-world applications.
Once you understand this, you will start noticing LED signals everywhere around you.
Indicators
LED blinking is commonly used as an indicator in electronic devices.
For example:
- Power ON/OFF indicators
- Charging status lights
- Warning signals
These LEDs use the same ON and OFF logic that you learned in this tutorial.
Testing Circuits
Blinking an LED is one of the easiest ways to test whether your circuit is working properly.
If the LED blinks as expected, it means:
- Your connections are correct
- Your code is working
- Your Arduino is functioning properly
This makes it a useful first step before building more complex projects.
Debugging
LEDs are also used for debugging programs. You can use them to check whether a certain part of your code is running.
For example:
- Turn LED ON when a condition is true
- Turn LED OFF when something fails
This helps you understand what is happening inside your program without using complex tools.
So even though this project looks simple, it forms the foundation for many real-world applications.
Frequently Asked Questions (FAQ)
{alertInfo} Quick answers to common questions about Arduino LED blinking.
What is LED blink in Arduino?
LED blinking in Arduino means turning an LED ON and OFF repeatedly using code. It is one of the simplest ways to learn how Arduino controls output devices.
Why is my LED not blinking?
This can happen due to small mistakes like:
- Wrong LED polarity (reversed connection)
- No resistor used
- Wrong pin connection
- Code not uploaded properly
Check these points, and your LED should start working.
Which pin is used for LED blinking?
Most beginners use pin 13 because it is connected to the built-in LED on the Arduino Uno board.
However, you can use any digital pin by changing the pin number in the code.
Can I use LED without a resistor?
It is not recommended. Without a resistor, too much current can flow through the LED and damage it.
Always use a resistor (around 220Ω) to protect your components.
Final Thoughts
Now you have created your first Arduino project — blinking an LED. It may look simple, but this is the most important step in your learning journey.
When I first completed this, it felt like a small achievement. But later I realized that this simple concept is used in many real-world applications.
Through this tutorial, you have learned:
- How to connect basic components
- How to write and upload code
- How Arduino controls hardware
This is just the beginning. Once you understand this, you can start building more advanced projects step by step.
👉 Now it’s time to move forward.
In the next tutorial, we will learn how to use a push button with Arduino and understand how input devices work in real-time.
{alertSuccess} Next Step: Learn Arduino Push Button Tutorial and control circuits using user input 🚀
Thank you for reading this tutorial. If you have any questions, feel free to leave a comment — we will try to respond as soon as possible.


