1. LED Blink
The "Hello World" of electronics. In this project, you will learn how to write your first program, upload it to the Arduino board, and control a Light Emitting Diode (LED).
Components Required
- 1x Arduino UNO R3 Buy
- 1x 5mm LED (Any Color)
- 1x 220Ω Resistor
- 1x Breadboard
- 2x Jumper Wires (Male-to-Male)
Tools Required
-
Computer (Windows/Mac/Linux) To write and upload code.
-
USB Cable To connect the Arduino to your computer.
Circuit Diagram
Follow the schematic below to wire up your components on the breadboard.
Important Wiring Note
Make sure to connect the longer leg (anode) of the LED to Digital Pin 13 through the resistor, and the shorter leg (cathode) to GND.
Step-by-Step Instructions
Connect the LED
Place the LED on the breadboard. Connect a 220Ω resistor to the long leg (anode). Connect a wire from the other end of the resistor to Pin 13 on the Arduino.
Connect to Ground
Connect a wire from the short leg (cathode) of the LED to any of the GND pins on the Arduino board.
Connect to Computer
Use the USB cable to connect the Arduino to your computer. Open the Arduino IDE software.
The Code
// The setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(13, OUTPUT); } // The loop function runs over and over again forever void loop() { digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(13, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
Copy this code and paste it into the Arduino IDE. Select your Arduino board and port from the Tools menu, then click the "Upload" arrow button.
Troubleshooting
-
LED not blinking?
Check if the LED is plugged in backwards. Try flipping it around. -
Upload Error?
Make sure you have selected the correct Board and Port in the Arduino IDE Tools menu.
Downloads
Project Complete! 🎉
Great job completing your first project. Ready to add more complexity?
Next Project: Traffic Light