Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: TeensyLC as HID + serial +USB OTG

  1. #1
    Junior Member
    Join Date
    Jul 2019
    Posts
    5

    TeensyLC as HID + serial +USB OTG

    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)
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Screen Shot 2019-07-09 at 1.05.12 PM.jpg 
Views:	0 
Size:	41.4 KB 
ID:	16944  
    Last edited by JasonH; 07-09-2019 at 07:31 PM. Reason: added recognized as a keyboard

  2. #2
    Junior Member
    Join Date
    Jul 2019
    Posts
    5
    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.

    (I thought it was a voltage/baud thing)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •