Blinking LED

The basic idea behind the blinking LED Arduino project is to introduce beginners to programming and electronics by creating a simple circuit that controls an LED (Light Emitting Diode).
​
How it Works:
The LED is connected to one of the Arduino's digital pins.
In the code, you set that pin to HIGH (which means ON or 5 volts is supplied), this turns the LED on.
Then you use a delay to wait a short amount of time.
Next, you set the pin to LOW (which means OFF or 0 volts is supplied). this turns the LED off.
​
Another delay happens, then the steps repeat in a loop.
This cycle of ON–OFF creates the blinking effect.
Materials

To build a simple LED blinking project with an Arduino Uno, you'll need the following materials:
Components:
1) Arduino Uno
-
The microcontroller board you'll use to control the LED.
2) LED
-
Light Emitting Diode that you want to blink.
3) 220Ω Resistor
-
To limit the current going through the LED and prevent it from burning out.
4) Breadboard
-
A tool for prototyping circuits without soldering.
5) Jumper Wires
-
To connect the components on the breadboard to the Arduino.
​
6) USB Cable Type-A to Type-B:
-
Connects the Arduino to your computer for programming and power.
Basic Setup

1) Connect the LED:
-
Insert the LED into the breadboard. The longer leg (anode) is the positive side, and the shorter leg (cathode) is the negative side. Another way of identifying the negative side, is to look at the circumference of the base of the coloured plastic LED tip. There will be a flat edge for the negative side.
2) Add the Resistor:
-
Connect one end of the 220Ω resistor to the anode (long leg) of the LED, and the other end to a row on the breadboard.
3) Wire the LED to Arduino:
-
Connect a jumper wire from the row on the breadboard where the resistor connects to the anode of the LED to a digital output pin on the Arduino (e.g., pin 13).
-
Connect another jumper wire from the cathode of the LED to one of the GND (ground) pins on the Arduino.
​​
4) Power the Arduino:
-
Connect the Arduino to your computer using the USB cable. This will provide power to the Arduino and allow you to upload the code.


CODE BREAK-DOWN
-
Declaring the LED Pin
int ledPin = 13;
Here, we define a variable ledPin with a value of 13. This specifies the pin on the Arduino board where the LED is connected.
​
-
The setup Function
The setup function runs once when the Arduino is powered on or reset.
-
pinMode(ledPin, OUTPUT); sets pin 13 as an output. This means we’re configuring this pin to send a signal (HIGH or LOW) to the LED.
-
​
-
The loop Function
The loop function runs continuously after setup is completed.
-
digitalWrite(ledPin, HIGH); sends a HIGH signal (5V) to pin 13, turning the LED on.
-
delay(1000); pauses the program for 1000 milliseconds (1 second). During this delay, the LED stays on.
-
digitalWrite(ledPin, LOW); sends a LOW signal (0V) to pin 13, turning the LED off.
-
Another delay(1000); keeps the LED off for 1 second.
-