Arduino Pro Micro - switch off LEDs
Kind of.
You don't have to change pins_arduino.h
.
Try the LED_BUILTIN_TX
and the LED_BUILTIN_RX
.
The pins are turned on and off by the code for the SerialUSB port. That can not be changed without changing the Arduino libraries. Setting that pin to INPUT in your sketch in the setup() function will turn them off:
pinMode(LED_BUILTIN_TX,INPUT);
pinMode(LED_BUILTIN_RX,INPUT);
If you have troubles with the LED_BUILTIN_TX
and the LED_BUILTIN_RX
, then you can use this as well:
bitClear(DDRD,5);
bitClear(DDRB,0);
The code for the SerialUSB port still writes to that pin, but once they are set as INPUT, that code will turn on and off the pullup resistor. That is no problem since those leds are connected to VCC.
To turn them on is also possible, but then those pins needs to be OUTPUT and LOW. They will not stay on when the SerialUSB port is used.
Kind of.
You would need to edit the pins_arduino.h
file for the Pro Micro board to change the definitions of the TXLED0
, TXLED1
, RXLED0
, RXLED1
and TX_RX_LED_INIT
macros.
You want them to all be defined, but empty.
#undef TXLED0
#undef TXLED1
#undef RXLED0
#undef RXLED1
#undef TX_RX_LED_INIT
#define TXLED0
#define TXLED1
#define RXLED0
#define RXLED1
#define TX_RX_LED_INIT
That will remove the current definitions, and then create new empty definitions. Without the empty definitions, you will get errors when compiling.