The Arduino boards come with a useful component known as the built-in LED. This LED is easily identifiable by the letter L located next to it. On the Arduino Uno, you can find it near pin #13, while on the Arduino MKR 1010 WiFi board, it is positioned near the 5V output pin.

In most Arduino boards, this LED is connected to the digital I/O pin #13. However, on certain boards like the Arduino MKR series, it is linked to pin #6. To conveniently reference the exact pin, the LED_BUILTIN constant is available. The Arduino IDE automatically maps this constant to the appropriate pin, depending on the board you are compiling for.

To illuminate the LED, you first need to set the pin as an output in the setup() function using the following code:

pinMode(LED_BUILTIN, OUTPUT);

Once the pin is set as an output, you can send a HIGH signal to it using either of these commands:

digitalWrite(LED_BUILTIN, HIGH);

or

digitalWrite(LED_BUILTIN, 1);

To demonstrate how the built-in LED can be used, let’s consider a simple program that blinks the LED every second:

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

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

Using this program, the built-in LED will turn on for one second, followed by a one-second pause before turning off and repeating the cycle.

By understanding and utilizing the built-in LED on Arduino boards, you can incorporate visual feedback and add interactive elements to your projects.