Blink LED Using Arduino

thumbnail

Blinking LED is the simplest program you can do with Arduino.

Hardware Required

  • Arduino UNO Board
  • 1 LED
  • 220-ohm resistor

Circuit Diagram

Connect the positive leg of the LED to the other end of the resistor. Connect the negative leg of the LED to the GND. Connect the other end of the resistor to the D13 pin of Arduino, which is the default LED_BUILTIN in the Arduino Uno Board. Refer to the below diagram.

Program

Open your Arduino IDE and paste the below code and compile the program then upload code to Arduino Board. Make sure that you have connected your computer to the Arduino Board. Once uploaded the code LED starts blinking.

HIGH indicates the high voltage and LOW indicates low voltage. delay refer to the waiting time, you can adjust the delay and check the difference.

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn on LED
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn off LED
  delay(1000);                       // wait for a second
}

Leave a Reply

Your email address will not be published. Required fields are marked *

three × three =

Back To Top