Every Arduino journey starts here. This tutorial walks through wiring an LED to a digital pin and writing the sketch that makes it blink — the "Hello World" of embedded electronics, and the foundation every later tutorial in this series builds on.
Beginner
⌛ 15 min
🔧 What You'll Need
- Arduino Uno (or compatible)
- 1x LED
- 1x 220Ω resistor
- Breadboard
- 2x jumper wires
Wiring the Circuit
Connect the LED's longer leg (anode) through the 220Ω resistor to digital pin 8. Connect the shorter leg (cathode) directly to GND. The resistor limits current through the LED so it doesn't burn out — never skip it.
The Code
void setup() {
pinMode(8, OUTPUT);
}
void loop() {
digitalWrite(8, HIGH); // LED on
delay(1000); // wait 1 second
digitalWrite(8, LOW); // LED off
delay(1000); // wait 1 second
}
pinMode(8, OUTPUT) tells the Arduino pin 8 will send voltage out, not read it. Inside loop(), digitalWrite(8, HIGH) sends 5V to light the LED, and delay(1000) pauses execution for 1000 milliseconds before switching it off. This loop repeats forever, which is exactly how loop() is meant to work.
💡 Tip: If the LED doesn't light, flip it around — LEDs only conduct in one direction. If it still doesn't light, double-check the resistor is actually in the circuit, not just nearby on the breadboard.
Troubleshooting
- LED stays off entirely: Check the LED's orientation (flat side = cathode/negative) and confirm the resistor is inline, not bypassed.
- Upload fails: Confirm the correct board and port are selected under Tools in the Arduino IDE.
- LED flickers instead of blinking cleanly: A loose breadboard connection is the usual cause — reseat the jumper wires.
Once this is working, you understand the two core Arduino concepts — digital output and timing — that every project in this series builds on. Next up: reading input instead of just sending it.
Menu