Blinking LED (Basic)

1. Blinking LED (Basic)

🧠 Project Description

The Blinking LED project is the simplest and most common beginner Arduino project. It teaches you how to control an LED using Arduino by turning it ON and OFF at regular intervals. This helps you understand the digital output concept and how to use the pinMode() and digitalWrite() functions in Arduino programming.

This project is often considered the “Hello World” of Arduino — a perfect starting point to learn the basics of microcontroller programming, timing control, and circuit building.


⚙️ Components Required

ComponentQuantityDescription
Arduino UNO / Nano1The main microcontroller board
LED (Any color)1Output component that blinks
Resistor (220Ω or 330Ω)1Limits current to protect LED
Breadboard1For easy circuit connection
Jumper WiresFewTo connect the circuit

Circuit

🔌 Circuit Explanation

  1. Connect the LED:
    • The long leg (anode) of the LED connects to Arduino digital pin 8 (or any other pin) through a 220Ω resistor.
    • The short leg (cathode) connects to GND (ground).
  2. Resistor Role:
    The resistor limits the current flowing through the LED, preventing it from burning out.
  3. How It Works:
    • When the Arduino sends a HIGH signal to pin 8, current flows and the LED turns ON.
    • When the signal is LOW, the current stops and the LED turns OFF.
    • The program repeats this ON/OFF cycle to make the LED blink.

💻 Arduino Code

// Blinking LED Project

int ledPin = 8;  // LED connected to digital pin 8

void setup() {
  pinMode(ledPin, OUTPUT);  // Set pin as output
}

void loop() {
  digitalWrite(ledPin, HIGH);  // Turn LED ON
  delay(1000);                 // Wait for 1 second
  digitalWrite(ledPin, LOW);   // Turn LED OFF
  delay(1000);                 // Wait for 1 second
}

🧩 Code Explanation

LineExplanation
int ledPin = 8;Stores the LED pin number.
pinMode(ledPin, OUTPUT);Configures pin 13 as an output pin.
digitalWrite(ledPin, HIGH);Sends 5V to the LED → turns it ON.
delay(1000);Waits 1000 ms (1 second) before the next action.
digitalWrite(ledPin, LOW);Turns the LED OFF by setting voltage to 0V.
The loop()Repeats the ON/OFF sequence continuously.

Working Principle

The Arduino continuously switches the LED ON and OFF with a 1-second delay. This timing can be changed by adjusting the value inside the delay() function (e.g., delay(500) for half-second blinking).


🧪 Experiment Ideas

  • Change the delay time to make it blink faster or slower.
  • Connect multiple LEDs to different pins and blink them in a pattern.
  • Use the built-in LED on pin 13 (no external LED needed).

Learning Outcome

By completing this project, you’ll learn:

  • How to connect and control an LED using Arduino.
  • Basic use of pinMode(), digitalWrite(), and delay().
  • The concept of digital output and timing control.

This Post Has One Comment

Leave a Reply