I am doing a project that requires me to control both a mouse/keyboard combination and a serial port to activate it. (I know, it can prevent me from using my computer, etc. but I have precautions already in place.) However, can the Arduino Leonardo be two devices (or technically three) at once without any additional hardware? I know Arduino has example on how to use both the keyboard and mouse at once, but is it possible for the Leonardo to compute the "triathlon of serial communications?"
I know there is one output that goes to the USB and one that can go to the TX/RX, so I could technically buy a serial to USB converter and hook it up for the serial side, but that can get pricey and hog two USB ports instead of one (very valuable on a laptop and a hub is not economical when you add shipping and the price for the UART module, and it is more fun figuring this out.
Best Answer
It looks like the keyboard and mouse example on the arduino site already has a method for reading the serial port.
right here:
If you can read the serial port, it seems like you can write to it too. I don't have a leonardo board to test this out myself, but inside of the
loop()
function you should be able to add something likeand verify this while the
Mouse
andKeyboard
are running too.