Skip to main content

LED BLINK

Arduino LED Blink Thumbnail

Introduction

In this tutorial, you’ll make a real LED blink using Arduino UNO or ESP32 in under 5 minutes.
This is the classic first project that teaches how software controls real hardware using digital output pins.


What you’ll learn

  • How digital output pins work
  • How to safely connect an LED
  • What pinMode() and digitalWrite() actually do
  • How changing delays affects hardware behavior

Components Needed

ComponentQuantityPurpose
Arduino UNO or ESP321Runs the program
LED1Visual output
Resistor (220Ω)1Protects the LED from damage
Breadboard1Easy wiring without soldering
Jumper Wires3–4Connects everything

Circuit & Schematic

The circuit diagram shows physical connections.
The schematic shows how electricity flows.

LED Blink Circuit DiagramLED Blink Schematic Diagram

Wiring Instructions

  1. Insert the LED into the breadboard
  2. Connect a 220Ω resistor to the long leg (anode) of the LED
  3. Connect the other end of the resistor to digital pin 13
  4. Connect the short leg (cathode) of the LED to GND
  5. Plug your Arduino or ESP32 into your computer using USB

⚠️ Important

  • If the LED is reversed, it won’t light up (this is safe)
  • Never connect an LED directly to a pin without a resistor

Arduino Code

This program turns the LED ON for 1 second and OFF for 1 second, repeatedly.

arduino-led-blink.ino
void setup() {
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}

How the code works

  • pinMode(13, OUTPUT) tells the board that pin 13 will control an output device
  • digitalWrite(13, HIGH) sends voltage to the LED and turns it ON
  • delay(1000) pauses the program for 1 second (1000 milliseconds)

Try This

Change the delay value in the code:

delay(200);
  • What happens when you make it smaller?
  • What happens when you make it larger?

This is how you start learning by experimenting.


Common Problems

  • LED not blinking → Check LED direction
  • Nothing happens → Verify pin number and wiring
  • Board not detected → Try a different USB cable

🚀 What’s Next?

  • Blink using a different pin
  • Control LED using a button
  • Learn smooth fading using PWM

🤖 Tip: Ask the AI assistant to modify this code for PWM or button control.

Notes

Add more images by copying one <figure> block and changing the file + caption.

Leave a Comment

No Comments yet.