2 Replies Latest reply on Oct 12, 2015 7:37 PM by giocaba

    USB Host Keyboard

    giocaba

      Hello

       

      I don´t know how I can get the character that I press from the keyboard.

       

      I used the example for Arduino IDE USB HOST, but I get a diferent character that I press , for example: I press the Q key, but the serial monitor shows:

       

      Pressed:   key:16 mod:1 => L-Ctrl m

      Released:  key:16 mod:0 => m

       

      I understod that the program shows the OEM-code (What is that?). I want that the program shows the key that I press in the keyboard. For example: I press the Q key and the serial monitor shows the letter Q.

       

      I appreciate your help.

        • 1. Re: USB Host Keyboard
          CMata_Intel

          Hi giocaba,

           

          I tried the same example and I’m having the same output. The OEM code means “Original Equipment Manufacturer” and the purpose of them is to identify a key in the keyboard not the character of it.

          If you want that the Arduino sketch returns the character of the key you are pressing, you have 2 choices. One, modify the libraries so when you use .getKey() or .getOemKey() you get the character and not the OEM value. The other choice is to modify the sketch in order to manage the results you are getting and translate the OEM values into the character you want, for example:

          You are getting 16 while pressing q, you can use this to create a routine that translates these numbers into the real character of the keyboard.

           

          Regards,

          Charlie

          • 2. Re: USB Host Keyboard
            giocaba

            Hi Charlie,

             

            Thank you for your help, I go to use the number and then get the real character.