arduino leonardo as keyboard input
I need a fast key for space bar and arrows to control netflix.
arduino has a keyboard.h lib for HID capable, seach on web, it seems keyboard sends out value for each key. presented as key codes
I need:
VK_SPACE | 0x20 | 空格鍵 |
VK_LEFT | 0x25 | 向左鍵 |
VK_RIGHT | 0x27 | 向右鍵 |
I tried example from keyboard.write() it write "A" when D2 pressed.
it works, but print out several "A"s, when pressed once, I think I need to use edge detection.
鍵 盤 鍵 碼 值 對 照 表 |
數字鍵 | 鍵碼值 | 數字鍵 | 鍵碼值 | 數字鍵 | 鍵碼值 |
1 | 49 | F1 | 112 | Numbpad 0 | 96 |
2 | 50 | F2 | 113 | Numbpad1 | 97 |
3 | 51 | F3 | 114 | Numbpad2 | 98 |
4 | 52 | F4 | 115 | Numbpad3 | 99 |
5 | 53 | F5 | 116 | Numbpad4 | 100 |
6 | 54 | F6 | 117 | Numbpad5 | 101 |
7 | 55 | F7 | 118 | Numbpad6 | 102 |
8 | 56 | F8 | 119 | Numbpad7 | 103 |
9 | 57 | F9 | 120 | Numbpad8 | 104 |
F10 | 121 | Numbpad9 | 105 | ||
F11 | 122 | Multiply (*) | 106 | ||
F12 | 123 | Add (+) | 107 | ||
Enter | 108 | ||||
Subtract (-) | 109 | ||||
Decimal (.) | 110 | ||||
Divide (/) | 111 |
字母 | 鍵碼值 | 字母 | 鍵碼值 | 其它鍵 | 鍵碼值 | 其它鍵 | 鍵碼值 |
A | 65 | N | 78 | Backspace | 8 | Left Arrow | 37 |
B | 66 | O | 79 | Tab | 9 | Up Arrow | 38 |
C | 67 | P | 80 | Clear | 12 | Right Arrow | 39 |
D | 68 | Q | 81 | Enter | 13 | Down Arrow | 40 |
E | 69 | R | 82 | Shift | 16 | Insert | 45 |
F | 70 | S | 83 | Control | 17 | Delete | 46 |
G | 71 | T | 84 | Alt | 18 | Help | 47 |
H | 72 | U | 85 | Caps Lock | 20 | Num Lock | 144 |
I | 73 | V | 86 | Esc | 27 | ; : | 186 |
J | 74 | W | 87 | Spacebar | 32 | = + | 187 |
K | 75 | X | 88 | Page Up | 33 | - _ | 189 |
L | 76 | Y | 89 | Page Down | 34 | / ? | 191 |
M | 77 | Z | 90 | End | 35 | \Q ~ | 192 |
Home | 36 | [ { | 219 | ||||
\ | | 220 | ||||||
] } | 221 | ||||||
'' ' | 222 |
I get my arduino leobardo work with space bar(0x20) and K(0X4B) to stop youtube.
but left arrow(0x25) does not work, in return , J(0X4A) as back 10sec and L(0X4C)
works.
留言
張貼留言