LED does not work in test examples on a Pro Micro
Description of Issue
Since the Pro Micro LED uses pin 17, and is wired in reverse logic, the LED does not work in the test examples.
Technical Details
SparkFun Pro Micro Windows 10 IDE v 1.8.5
I tested this with my Pro Micro, but couldn't find my Micro.
-
Add (to beginning) - #if defined (ARDUINO_AVR_PROMICRO) #define LED_PIN 17 #define LED_ON 0 #define LED_OFF 1 #else #define LED_PIN 13 #define LED_ON 1 #define LED_OFF 0 #endif
-
Change - pinMode(13, OUTPUT); to pinMode(LED_PIN, OUTPUT);
digitalWrite(13, 0); to digitalWrite(LED_PIN, LED_OFF);
digitalWrite(13, 1); to digitalWrite(LED_PIN, LED_ON);
Thanks
An option for automatically determining the LED pin for any board would be to use the LED_BUILTIN macro:
digitalWrite(LED_BUILTIN, LED_ON);
I like the idea of LED_BUILTIN, but it doesn't work for the Pro Micro.