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 di…


This content originally appeared on flaviocopes.com and was authored by flaviocopes.com

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);
}


This content originally appeared on flaviocopes.com and was authored by flaviocopes.com


Print Share Comment Cite Upload Translate Updates
APA

flaviocopes.com | Sciencx (2020-12-30T05:00:00+00:00) The Arduino built-in LED. Retrieved from https://www.scien.cx/2020/12/30/the-arduino-built-in-led/

MLA
" » The Arduino built-in LED." flaviocopes.com | Sciencx - Wednesday December 30, 2020, https://www.scien.cx/2020/12/30/the-arduino-built-in-led/
HARVARD
flaviocopes.com | Sciencx Wednesday December 30, 2020 » The Arduino built-in LED., viewed ,<https://www.scien.cx/2020/12/30/the-arduino-built-in-led/>
VANCOUVER
flaviocopes.com | Sciencx - » The Arduino built-in LED. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2020/12/30/the-arduino-built-in-led/
CHICAGO
" » The Arduino built-in LED." flaviocopes.com | Sciencx - Accessed . https://www.scien.cx/2020/12/30/the-arduino-built-in-led/
IEEE
" » The Arduino built-in LED." flaviocopes.com | Sciencx [Online]. Available: https://www.scien.cx/2020/12/30/the-arduino-built-in-led/. [Accessed: ]
rf:citation
» The Arduino built-in LED | flaviocopes.com | Sciencx | https://www.scien.cx/2020/12/30/the-arduino-built-in-led/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.