Arduino LED Blinking Tutorial

Things You’ll Need

  • Arduino UNO board
  • 1 x LED (any color)
  • 1 x 220Ω resistor
  • Breadboard
  • Jumper wires
  • USB cable to connect Arduino to your computer

Step 1: Circuit Connections

The LED has two legs: long leg = anode (+), short leg = cathode (–).

  • Connect the anode (long leg) to pin 13 on the Arduino through a 220Ω resistor.
  • Connect the cathode (short leg) to the Arduino’s GND.

Step 2: Building the Circuit

  1. Place the LED on the breadboard.
  2. Connect a 220Ω resistor to the long leg of the LED.
  3. Use a jumper wire to connect the other side of the resistor to digital pin 13.
  4. Connect the short leg of the LED directly to GND on the Arduino.

Step 3: Write the Code

Let’s now write the code for the Arduino sketch. Launch the Arduino IDE and enter:


void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH); // turn LED on
  delay(1000);            // wait 1 second
  digitalWrite(13, LOW);  // turn LED off
  delay(1000);            // wait 1 second
}