SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By stebrick
Dear Guys, I’m using PROMICRO 5V-16MHz to emulate both an usb mouse and keyboard..It works good but when I send some character keyboard or mouse movement by usb connected to a PC, the promicro board always turn on/off the TXLED pin. This is a problem for me because I need to use this pin as a digital output to drive a relays. Generally I want to use What could I do to separate the behaviour of TXLED from the keyboard and mouse functions?? need help :o regards..
By stebrick
Yes, I use all the pins and also an I2c i/o expander! But in particular I need txled and other to drive some relays.. Do you know how to disable txled when promicro is sending something as keyboard/mouse by USB??
By paulvha
wow.. maybe you should take a board with more connections (like a MEGA2560).

It expect it will require a software change in the board library (pins.h) and I can look into that tomorrow. I don't have this board but In the end (and beginning) it is only software. Just be aware that the output for the TXLED ( D17/ PB0) is not available on the 18 pin connection and will require on-board soldering of a connection
By paulvha
The best I could find, but not able to test as I do not have a Pro-micro, is in the file <arduino_install_dir>/ packages/Sparkfun/hardware/avr/1.1.12/variants/promicro/pins_arduino.h. At least on my Ubuntu system, you will have to look for similar structure on your PC.

In there is a definition of switching off the TX led : #define TXLED0 PORTD |= (1<<5)
AND switching on : #define TXLED1 PORTD &= ~(1<<5).
The TXled is connected to to PD5.

If you comment those 2 definition out and try to recompile your sketch it will fail as USBcore.cpp is expecting those. Try to change the definitions to PORTD6, as that is not used on the pro-micro and recompile /upload the sketch :
#define TXLED0 PORTD |= (1<<6)
#define TXLED1 PORTD &= ~(1<<6)

In the same file there is also : #define LED_BUILTIN_TX 30. Pin 30 is mapped to PD5 in the structures underneath and you should not change. This LED_BUILTIN_TX is normally a global variable that one can use in a sketch ( e.g. digitalwrite (LED_BUILTIN_TX, HIGH)

By paulvha
Good to hear. Opposite to my earlier remark that the TX led is connected to D17/PB0, the TX led is actually connected to pin 22 (PD5) or just use the LED_BUILTIN_TX variable in your code. On D17/PB0 the RX led is connected. (I misread the schematics)
By stebrick
Yes you are right.. I also tested promicro with an I/O expander MCP23017 via I2C connection.. It works great to add up 16 I/O to promicro board.. It's easy to set up with wire.h library.. Maybe it could interest in this solution :)