Community
cancel
Showing results for 
Search instead for 
Did you mean: 
FCaba
Novice
1,655 Views

USB Host Keyboard

Jump to solution

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.


Accepted Solutions
Carlos_M_Intel
Employee
328 Views

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

View solution in original post

2 Replies
Carlos_M_Intel
Employee
329 Views

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

View solution in original post

FCaba
Novice
328 Views

Hi Charlie,

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