Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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;?

share|improve this question
up vote 4 down vote accepted

#define LED_BUILTIN 13

(source)

share|improve this answer

Try LED_BUILTIN:

pins_arduino.h:static const uint8_t LED_BUILTIN = 13;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.