I am using a Arduino Pro Micro as a keyboard (USB HID device). Each time I press a key, the RX LED and TX LED light up. Can I switch them off in software?

2 Answers 2


Kind of.

You don't have to change pins_arduino.h.
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:


If you have troubles with the LED_BUILTIN_TX and the LED_BUILTIN_RX, then you can use this as well:


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

#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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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