Go Down

Topic: Keyboard.Write with Number Pad Keys from Leonardo (Read 4735 times) previous topic - next topic

boxgamex

Has anyone ever actually been able to trigger the keypress of a number pad key using the Keyboard.write commands from an Arduino? I can trigger keys like a-z, 0-9 fine, but I either cannot find the appropriate ascii/hex (despite many different results found on google that I have attemtped) or it just doesnt work. I have even tried the hex codes outlined by the USB organization (http://www.usb.org/developers/devclass_docs/Hut1_11.pdf) with no luck.

johnwasser

#1
Jul 27, 2013, 02:33 am Last Edit: Jul 27, 2013, 02:38 am by johnwasser Reason: 1
I think you will need to call keyboard.press(value) and keyboard.release(value) (or .releaseAll()).

The keypad keys are 84 through 99 (0x54 through 0x63) but the keyboard.press() function will treat values below 128 (0x7F) as "printable" so it will look them up in a table of ascii keycodes.  To get past that you have to add 136 to the keycode.  Try these:

220 '\334' Keypad /
221 '\335' Keypad *
222 '\336' Keypad -
223 '\337' Keypad +
224 '\340' Keypad ENTER
225 '\341' Keypad 1 and End
226 '\342' Keypad 2 and Down Arrow
227 '\343' Keypad 3 and PageDn
228 '\344' Keypad 4 and Left Arrow
229 '\345' Keypad 5
230 '\346' Keypad 6 and Right Arrow
231 '\347' Keypad 7 and Home
232 '\350' Keypad 8 and Up Arrow
233 '\351' Keypad 9 and PageUp
234 '\352' Keypad 0 and Insert
235 '\353' Keypad . and Delete
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

boxgamex


Go Up