Materials
Blinking LED
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:
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.
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
Explanation:
ledPin = 13;: Assigns pin 13 to the ledPin variable.
pinMode(ledPin, OUTPUT);: Sets pin 13 as an output pin.
digitalWrite(ledPin, HIGH);: Turns the LED on.
delay(1000);: Waits for 1 second (1000 milliseconds).
digitalWrite(ledPin, LOW);: Turns the LED off.
delay(1000);: Waits for another second.
This will make the LED blink on and off with a 1-second interval.
You can modify the delay values to change the blink speed.