Go Down

Topic: USB HID emulation and regular Serial traffic... no conflict? (Read 35 times) previous topic - next topic

Tazling

I have some fairly elaborate USB emulation running on a couple of Leonardos (Keyboard, Joystick, Mouse) and it occurred to me recently that I'm using the same USB port on the Leos for my Serial print and println commands directed at the serial monitor for debugging purposes.

Is this for any reason bad practise?  can my Serial.print statements interfere in any way with the use of the port for USB HID emulation?  Or is the Leonardo actually emulating multiple USB devices, one for Serial and one for each emulation library I initialise?  i.e. one Keyboard, one Joystick, etc.

This may be a really dumb question.  I don't think I've ever seen any evidence of interference.  I'm just wondering whether it might, for example, be wiser to complete one Keyboard interaction with the host machine in its entirety before doing a Serial.println command, rather than interspersing them.

Robin2

It sounds like what you are doing is working and you can send keystrokes as well as messages that appear on the Serial Monitor.

To be honest I did not know that was possible. I thought it had to be one or the other.

If you need more advice please post your program - ideally the shortest possible program that illustrates the situation.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up