Skip to content

The Arduino built-in LED

Arduino boards come with a little utility: the built-in LED.

It is identified by the letter L next to it. On the Arduino Uno, it is near pin #13:

On the Arduino MKR 1010 WiFi it is near the 5V output pin:

This LED is connected to the digital I/O pin #13 in most boards. In some boards, like the Arduino MKR series, it’s linked to the pin #6.

In any case you can reference the exact pin using the LED_BUILTIN constant, that is always correctly mapped by the Arduino IDE to the correct pin, depending on the board you are compiling for.

To light up the LED, first you need to set the pin to be an output in setup():

pinMode(LED_BUILTIN, OUTPUT);

Then you can send it a HIGH signal:

digitalWrite(LED_BUILTIN, HIGH);

or

digitalWrite(LED_BUILTIN, 1);

Here is a simple program that makes the built-in LED blink every second:

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

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

download all my books for free

  • javascript handbook
  • typescript handbook
  • css handbook
  • node.js handbook
  • astro handbook
  • html handbook
  • next.js pages router handbook
  • alpine.js handbook
  • htmx handbook
  • react handbook
  • sql handbook
  • git cheat sheet
  • laravel handbook
  • express handbook
  • swift handbook
  • go handbook
  • php handbook
  • python handbook
  • cli handbook
  • c handbook

subscribe to my newsletter to get them

Terms: by subscribing to the newsletter you agree the following terms and conditions and privacy policy. The aim of the newsletter is to keep you up to date about new tutorials, new book releases or courses organized by Flavio. If you wish to unsubscribe from the newsletter, you can click the unsubscribe link that's present at the bottom of each email, anytime. I will not communicate/spread/publish or otherwise give away your address. Your email address is the only personal information collected, and it's only collected for the primary purpose of keeping you informed through the newsletter. It's stored in a secure server based in the EU. You can contact Flavio by emailing flavio@flaviocopes.com. These terms and conditions are governed by the laws in force in Italy and you unconditionally submit to the jurisdiction of the courts of Italy.

Related posts about electronics: