Blink LED with Arduino

HelloArduino-1

Blinking an LED is the simplest way to get started with Arduino. This tutorial will guide you through connecting an LED to an Arduino board and writing a simple program to make it blink.

Materials Needed

  • Arduino board (e.g., Arduino Uno)

  • LED

  • 220-ohm resistor

  • Breadboard

  • Jumper wires

  • USB cable

     

required materials

Circuit Setup

Circuit layout
  • Insert the LED into the breadboard. The longer leg (anode) is the positive terminal, and the shorter leg (cathode) is the negative terminal.
LED diagram
  • Connect a 220-ohm resistor to the cathode leg of the LED and then to the ground (GND) pin on the Arduino.
  • Connect the anode leg of the LED to digital pin 13 on the Arduino.

Writing the Code

  • Open the Arduino IDE on your computer.
  • Create a new sketch and paste the following code:
void setup() {
    pinMode(13, OUTPUT); // Set pin 13 as an output
}
void loop() {
    digitalWrite(13, HIGH); // Turn the LED on
    delay(1000); // Wait for 1 second
    digitalWrite(13, LOW); // Turn the LED off
    delay(1000); // Wait for 1 second
}
  • Click the “Verify” button to check for errors.
  • Connect the Arduino to your computer using the USB cable.
  • Click the “Upload” button to send the code to the Arduino.

After uploading the code, the LED should blink on and off every second. You have successfully built and programmed a simple blinking LED circuit using Arduino. This fundamental project introduces basic concepts of microcontroller programming and circuit building, setting the stage for more complex projects!