I have a TeensyLC in HID mode and a serial port (Serial2).
I wrote code to take serial commands and turn them into HID events.
I use an 8-byte packet that is read and decoded which uses Keyboard and Mouse libraries.
The serial channel is used to send these messages and plain text messages back about what was decoded:
moveRel 0, -1, 0
moveRel -4, 0, 0
moveRel -2, 0, 0
moveRel -1, 0, 0
That works when I plug it into my own computer (and my mouse moves around accordingly).
However when I plug it into a phone using a USB OTG adapter, I get gibberish:
\xFD\x01\x01\x00\x00\x00\x00\x80
\xFD\x01\x00\x00\x00\x00\x00\x00
\xFD\x01\x00\x00\x00\x00\x00\x00
\xFD\xFF\x00\x00\x00\x00\x00\x00
\xFD\xFE\x80\x00\x00\x00\x00\x00
\xFD\xFF\x00\x00\x00\x00\x00\x00
\xFD\xFD\x00\x00\x00\x00\x00\x80
\xFD\xFE\x00\x00\x00\x00\x00\x00
But it is recognized as a keyboard (and presumably a mouse)
Last edited by JasonH; 07-09-2019 at 08:31 PM.
Reason: added recognized as a keyboard
Nevermind! It worked on the same computer because the grounds are connected. To the phone, they were not. Connecting the FTDI ground to the Teensy ground resolved the issue.