5

To use the onboard LED on an Arduino one usually has to know the pin number (13 in most cases), but is there a constant in the Arduino IDE one can use as well?

So is it possible to use something like int LED = ONBOARDLED; instead of using int LED = 13;?

Greenonline
  • 2,938
  • 7
  • 32
  • 48
bastelflp
  • 189
  • 1
  • 1
  • 10

2 Answers2

4

Try LED_BUILTIN:

pins_arduino.h:static const uint8_t LED_BUILTIN = 13;
Majenko
  • 105,095
  • 5
  • 79
  • 137
4

#define LED_BUILTIN 13

(source)

Gerben
  • 11,286
  • 3
  • 20
  • 34