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

Thread: How do I send a USB Keyboard # key

  1. #1
    Junior Member
    Join Date
    May 2017
    Posts
    10

    How do I send a USB Keyboard # key

    I am trying to use the Teensy LC to emulate a UK laptop keyboard. Everything works great apart from the "#" key.

    On a UK keyboard this is a separate physical key (near the enter key) that does not seem to exist on US keyboards. You see it here on this image:




    The common names for the key would be hash, pound or sharp but those donít seem to exist as defines in the teensy keyboard code.

    Does it have another name or how do I send that keypress?

    I do have UK selected as the keyboard type in the IDE if that makes a difference and I do get a £ sign for a shifted numberic 3 where a normal US keyboard # key would appear.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	800px-KB_United_Kingdom.svg.png 
Views:	9 
Size:	38.1 KB 
ID:	21399  

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,669
    Sorry hopefully someone who has done this already can better answer. Wonder what this one does?
    #define KEY_NON_US_NUM ( 50 | 0xF000 )

    But again not sure.

  3. #3
    Junior Member
    Join Date
    May 2017
    Posts
    10
    Thank you :-)

    That works fine.
    Last edited by gi1mic; 08-16-2020 at 08:04 PM.

  4. #4
    Do you know the ASCII or unicode value for #? Can you just send that value when the key is pressed?

    Just looked it up. It appears that "British pound" is 00A3 and # is 0023 hexidecimal in unicode.

    Hope that helps.

  5. #5
    Senior Member
    Join Date
    Jul 2020
    Posts
    398
    0xA3 and 0x23 to be pedantic... That allows copy and pasting without forgetting the base, well in many languages at least.

  6. #6
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,669
    Quote Originally Posted by OhioJim View Post
    Do you know the ASCII or unicode value for #? Can you just send that value when the key is pressed?

    Just looked it up. It appears that "British pound" is 00A3 and # is 0023 hexidecimal in unicode.

    Hope that helps.
    Again I am no expert, but I have worked at it from the other side, in adding the ability for keyboards to be plugged into the USB Host of T3.6 and T4.x

    What I remember is the keyboards will output some KeyCode that your software will interpret depending on things like country code or keyboard layout to convert the keycode(s) into the appropriate value that your application will see.

  7. #7
    Quote Originally Posted by MarkT View Post
    0xA3 and 0x23 to be pedantic... That allows copy and pasting without forgetting the base, well in many languages at least.
    Except Unicode is 16 bits, so it is 0x00A3 and 0x0023.

    A single byte is not big enough to handle all the special characters and symbols used in different languages.

    See the Wikipedia Article on it.

  8. #8
    Senior Member
    Join Date
    Jul 2020
    Posts
    398
    Well, yes, that might be worth making explicit too...

Posting Permissions

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