In learning any programming language, you often begin with some sort of Hello, World! program. In electronics, Hello, World! is blinking an LED. Blink is one of the simplest programs in Arduino. Despite its simplicity, it shows you many of the basic concepts needed for most Arduino programs, and provides a solid basis for more complex projects. Time to get blinky!

Finding the LED

The little built-in red LED (indicated by the red box in the image) is located towards the top of the board in the center. It is labeled "L" on the board.

First open the Arduino IDE and create a new sketch by clicking  File > New

Then, copy the code shown below and paste it into the new sketch.

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

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

The little red LED begins blinking!

First, you set up the LED on pin LED_BUILTIN and set the pin to be an output.

Then, inside the loop, you first turn the LED on (HIGH is the voltage level), and wait for 1 second (1000ms). Then you turn off the LED by setting the voltage low, and wait for another second.

Try changing the delay to see how it affects the blink speed.

That's all there is to blinking an LED with Arduino!

This guide was first published on Mar 24, 2021. It was last updated on 2021-03-24 12:20:00 -0400.

This page (Arduino Blink) was last updated on Jul 11, 2021.

Text editor powered by tinymce.