Get Ready with Arduino UNO LED Blinking

Introduction

The LED blinking project is the classic "Hello World!" of electronics and the perfect first step for anyone starting with Arduino UNO. In this project, you'll connect an external LED to your Arduino and write a simple sketch to make it blink on and off every second.

---

🔧 Components Required

• 1 × Arduino UNO R3
• 1 × LED (any color — red, green, or blue)
• 1 × 220Ω Resistor (or 330Ω works too)
• 1 × Breadboard
• 2 × Jumper Wires
• 1 × USB Cable (to connect Arduino to your PC)

---

⚡ Circuit Connections

1. Place the LED on the breadboard.
2. Connect the long leg (anode / +) of the LED to one end of the 220Ω resistor.
3. Connect the other end of the resistor to Digital Pin 13 on the Arduino UNO.
4. Connect the short leg (cathode / –) of the LED to the GND pin on the Arduino.

💡 Tip: LEDs are polarized — the longer leg is positive (anode) and the shorter leg is negative (cathode). Connecting them in reverse won't harm the Arduino but the LED won't light up.

---

💻 Arduino Code (Sketch)

// Define LED pin
#define LED_PIN 13

void setup() {
  // Set pin 13 as OUTPUT
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_PIN, HIGH);  // Turn LED ON
  delay(500);                   // Wait 500ms
  digitalWrite(LED_PIN, LOW);   // Turn LED OFF
  delay(500);                   // Wait 500ms
}

---

📤 How to Upload the Code

1. Install Arduino IDE from arduino.cc/en/software
2. Connect your Arduino UNO to your computer via USB.
3. Open Arduino IDE → Select Board: "Arduino UNO" under Tools > Board.
4. Select the correct COM Port under Tools > Port.
5. Copy and paste the above code into the editor.
6. Click the Upload button (→ arrow icon).
7. Watch your LED blink every half second!

---

🔍 Code Explanation

• #define LED_PIN 13 — Assigns digital pin 13 to the LED variable.
• void setup() — Runs once; sets pin 13 as an output.
• void loop() — Runs repeatedly; turns the LED ON, waits 500ms, turns it OFF, waits 500ms.
• digitalWrite(HIGH/LOW) — Sends 5V (HIGH) or 0V (LOW) to the pin.
• delay(500) — Pauses the program for 500 milliseconds (0.5 seconds).

---

✅ Expected Output

The LED connected to Pin 13 will blink ON and OFF every 0.5 seconds. You can change the delay value to make it blink faster or slower — try delay(100) for rapid blinking or delay(2000) for a slow 2-second blink!

---

📌 Difficulty Level: Beginner
⏱ Estimated Time: 15–20 minutes
🛠 Category: Arduino / Electronics / LED Projects

Back to blog