USB Host shield + HID keyboard functionality button

Hi!

I've been using USB Host shield 2.0 in my project where I'm getting input from a keyboard. I'd like to use buttons like ENTER, BACKSPACE and arrow keys. How can I detect them when they are pressed?

-Ty!

attepohjanmaa:
Hi!

I've been using USB Host shield 2.0 in my project where I'm getting input from a keyboard. I'd like to use buttons like ENTER, BACKSPACE and arrow keys. How can I detect them when they are pressed?

-Ty!

attepohjanmaa,
I'm not familiar with the USB Host shield, but this information should help you with the code.

  1. Many keyboards scan codes. You may NOT want to use this. It give you the codes sent by the keyboard. The link will give all the information you need. You can capture Functions keys (F1,F2,..F12), shift keys, and other keys.

However,
2) you likely want the ASCII code. This will get you [space], [enter], [backspace], etc.

FYI: Backspace is usually DEC #127, Hex x7F

Ask questions if you are not sure.
Jesse

How can I catch the ASCII code... I'm getting the pressed key from the library in uint_8 format.

uint_8 key;

(Funtion gives a return value key)

if((char)key == '+')

But how can I take the ASCII from it? (I'm catching backspace)

else if(key == '8')
else if(key == 8 )
else if((int)key == 8 )
else if((int)key == '8')
These won't work

Help needed!