Blinking an LED is the “hello world” of electronics. It checks that your board, cable and software all work, and it teaches the basic loop that every Arduino program uses. You need about 15 minutes.
What you need
- An Arduino Uno (or a compatible board) and its USB cable
- One 5 mm LED, any color
- One 220 Ω resistor (red, red, brown)
- A breadboard and two jumper wires
Step 1: Install the Arduino IDE
Download the free Arduino IDE from arduino.cc and install it. Connect the board by USB. In the IDE, choose Tools → Board → Arduino Uno, then pick the board’s port under Tools → Port. Clone boards with the CH340 USB chip may need the CH340 driver on Windows.
Step 2: Why the LED needs a resistor
An LED has almost no resistance once it switches on, so without a resistor it draws too much current and burns out. Calculate the resistor with Ohm’s law:
R = (supply voltage − LED voltage) ÷ current
For a red LED (about 2 V) on a 5 V pin at 15 mA: (5 − 2) ÷ 0.015 = 200 Ω. The nearest standard value above that is 220 Ω, which is safe for almost every color of LED.
Step 3: Wire it up
- Push the LED into the breadboard. The longer leg is the positive side (anode).
- Connect the 220 Ω resistor from the long leg to a free row.
- Run a jumper wire from that row to Arduino digital pin 8.
- Run a jumper wire from the LED’s short leg (cathode) to a GND pin.
Step 4: Upload the code
const int LED_PIN = 8;
void setup() {
pinMode(LED_PIN, OUTPUT); // runs once at power-up
}
void loop() {
digitalWrite(LED_PIN, HIGH); // LED on
delay(500); // wait half a second
digitalWrite(LED_PIN, LOW); // LED off
delay(500);
}
Click Upload. After a few seconds the LED should blink once per second.
It doesn’t work. What now?
- Upload error: check the board and port settings, and try another USB cable (some cables only carry power).
- Nothing lights: turn the LED around. LEDs only conduct one way.
- Still nothing: change
LED_PINto13and watch the small LED on the board itself. If that blinks, the problem is in your wiring.
Next steps
Change the delay values to make the LED blink faster, add a second LED on another pin, or add a push button to switch the LED on and off. Each of these teaches one new idea while building on the same loop.