Here's the list of keyboard modifier : Keyboard Modifiers - 아두이노 참조
but in the URL I don't see any modifiers in tenkey pad. Does anyone know a solution for this?
Here's the list of keyboard modifier : Keyboard Modifiers - 아두이노 참조
but in the URL I don't see any modifiers in tenkey pad. Does anyone know a solution for this?
See keys 83 through 103. Note that you have to use the numbers 219 through 239 to get the keycodes through Keyboard.
Modifier codes:
#define KEY_LEFT_CTRL 0x80
#define KEY_LEFT_SHIFT 0x81
#define KEY_LEFT_ALT 0x82
#define KEY_LEFT_GUI 0x83
#define KEY_RIGHT_CTRL 0x84
#define KEY_RIGHT_SHIFT 0x85
#define KEY_RIGHT_ALT 0x86
#define KEY_RIGHT_GUI 0x87
USB CODE Keyboard() Key Location on US-en Keyboard
======== ========== ==============================
0 0x00 Reserved (no event indicated) *9
1 0x01 Keyboard ErrorRollOver *9
2 0x02 Keyboard POSTFail *9
3 0x03 Keyboard ErrorUndefined *9
4 0x04 140 0x8C Keyboard a and A *4
5 0x05 141 0x8D Keyboard b and B
6 0x06 142 0x8E Keyboard c and C *4
7 0x07 143 0x8F Keyboard d and D
8 0x08 144 0x90 Keyboard e and E
9 0x09 145 0x91 Keyboard f and F
10 0x0A 146 0x92 Keyboard g and G
11 0x0B 147 0x93 Keyboard h and H
12 0x0C 148 0x94 Keyboard i and I
13 0x0D 149 0x95 Keyboard j and J
14 0x0E 150 0x96 Keyboard k and K
15 0x0F 151 0x97 Keyboard l and L
16 0x10 152 0x98 Keyboard m and M *4
17 0x11 153 0x99 Keyboard n and N
18 0x12 154 0x9A Keyboard o and O *4
19 0x13 155 0x9B Keyboard p and P *4
20 0x14 156 0x9C Keyboard q and Q *4
21 0x15 157 0x9D Keyboard r and R
22 0x16 158 0x9E Keyboard s and S *4
23 0x17 159 0x9F Keyboard t and T
24 0x18 160 0xA0 Keyboard u and U
25 0x19 161 0xA1 Keyboard v and V
26 0x1A 162 0xA2 Keyboard w and W *4
27 0x1B 163 0xA3 Keyboard x and X *4
28 0x1C 164 0xA4 Keyboard y and Y *4
29 0x1D 165 0xA5 Keyboard z and Z *4
30 0x1E 166 0xA6 Keyboard 1 and ! *4
31 0x1F 167 0xA7 Keyboard 2 and @ *4
32 0x20 168 0xA8 Keyboard 3 and # *4
33 0x21 169 0xA9 Keyboard 4 and $ *4
34 0x22 170 0xAA Keyboard 5 and % *4
35 0x23 171 0xAB Keyboard 6 and ^ *4
36 0x24 172 0xAC Keyboard 7 and & *4
37 0x25 173 0xAD Keyboard 8 and * *4
38 0x26 174 0xAE Keyboard 9 and ( *4
39 0x27 175 0xAF Keyboard 0 and ) *4
40 0x28 176 0xB0 Keyboard Return (ENTER) *5
41 0x29 177 0xB1 Keyboard ESCAPE
42 0x2A 178 0xB2 Keyboard DELETE (Backspace) *13
43 0x2B 179 0xB3 Keyboard Tab
44 0x2C 180 0xB4 Keyboard Spacebar
45 0x2D 181 0xB5 Keyboard - and (underscore) *4
46 0x2E 182 0xB6 Keyboard = and + *4
47 0x2F 183 0xB7 Keyboard [ and { *4
48 0x30 184 0xB8 Keyboard ] and } *4
49 0x31 185 0xB9 Keyboard \ and |
50 0x32 186 0xBA Keyboard Non-US # and ~ *2
51 0x33 187 0xBB Keyboard ; and : *4
52 0x34 188 0xBC Keyboard ‘ and “ *4
53 0x35 189 0xBD Keyboard Grave Accent and Tilde *4
54 0x36 190 0xBE Keyboard , and < *4
55 0x37 191 0xBF Keyboard . and > *4
56 0x38 192 0xC0 Keyboard / and ? *4
57 0x39 193 0xC1 Keyboard Caps Lock *11
58 0x3A 194 0xC2 Keyboard F1
59 0x3B 195 0xC3 Keyboard F2
60 0x3C 196 0xC4 Keyboard F3
61 0x3D 197 0xC5 Keyboard F4
62 0x3E 198 0xC6 Keyboard F5
63 0x3F 199 0xC7 Keyboard F6
64 0x40 200 0xC8 Keyboard F7
65 0x41 201 0xC9 Keyboard F8
66 0x42 202 0xCA Keyboard F9
67 0x43 203 0xCB Keyboard F10
68 0x44 204 0xCC Keyboard F11
69 0x45 205 0xCD Keyboard F12
70 0x46 206 0xCE Keyboard PrintScreen *1
71 0x47 207 0xCF Keyboard Scroll Lock *11
72 0x48 208 0xD0 Keyboard Pause *1
73 0x49 209 0xD1 Keyboard Insert *1
74 0x4A 210 0xD2 Keyboard Home *1
75 0x4B 211 0xD3 Keyboard PageUp *1
76 0x4C 212 0xD4 Keyboard Delete Forward *1;*14
77 0x4D 213 0xD5 Keyboard End *1
78 0x4E 214 0xD6 Keyboard PageDown *1
79 0x4F 215 0xD7 Keyboard RightArrow *1
80 0x50 216 0xD8 Keyboard LeftArrow *1
81 0x51 217 0xD9 Keyboard DownArrow *1
82 0x52 218 0xDA Keyboard UpArrow *1
83 0x53 219 0xDB Keypad Num Lock and Clear *11
84 0x54 220 0xDC Keypad / *1
85 0x55 221 0xDD Keypad *
86 0x56 222 0xDE Keypad -
87 0x57 223 0xDF Keypad +
88 0x58 224 0xE0 Keypad ENTER *5
89 0x59 225 0xE1 Keypad 1 and End
90 0x5A 226 0xE2 Keypad 2 and Down Arrow
91 0x5B 227 0xE3 Keypad 3 and PageDn
92 0x5C 228 0xE4 Keypad 4 and Left Arrow
93 0x5D 229 0xE5 Keypad 5
94 0x5E 230 0xE6 Keypad 6 and Right Arrow
95 0x5F 231 0xE7 Keypad 7 and Home
96 0x60 232 0xE8 Keypad 8 and Up Arrow
97 0x61 233 0xE9 Keypad 9 and PageUp
98 0x62 234 0xEA Keypad 0 and Insert
99 0x63 235 0xEB Keypad . and Delete
100 0x64 236 0xEC Keyboard Non-US \ and | *3;*6
101 0x65 237 0xED Application *10
102 0x66 238 0xEE Keyboard Power *9
103 0x67 239 0xEF Keypad =
104 0x68 240 0xF0 Keyboard F13
105 0x69 241 0xF1 Keyboard F14
106 0x6A 242 0xF2 Keyboard F15
107 0x6B 243 0xF3 Keyboard F16
108 0x6C 244 0xF4 Keyboard F17
109 0x6D 245 0xF5 Keyboard F18
110 0x6E 246 0xF6 Keyboard F19
111 0x6F 247 0xF7 Keyboard F20
112 0x70 248 0xF8 Keyboard F21
113 0x71 249 0xF9 Keyboard F22
114 0x72 250 0xFA Keyboard F23
115 0x73 251 0xFB Keyboard F24
116 0x74 252 0xFC Keyboard Execute
117 0x75 253 0xFD Keyboard Help
118 0x76 254 0xFE Keyboard Menu
119 0x77 255 0xFF Keyboard Select
(END OF CODES REACHABLE FROM Keyboard.write)
To use keycodes beyond this point you have to add some functions to the Keyboard library to allow you to send raw keycodes:
// pressRaw() adds the specified USB raw keycode to the persistent key
// report and sends the report.
size_t Keyboard_::pressRaw(uint8_t k)
{
uint8_t i;
// Add k to the key report only if it's not already present
// and if there is an empty slot.
if (_keyReport.keys[0] != k && _keyReport.keys[1] != k &&
_keyReport.keys[2] != k && _keyReport.keys[3] != k &&
_keyReport.keys[4] != k && _keyReport.keys[5] != k) {
for (i=0; i<6; i++) {
if (_keyReport.keys[i] == 0x00) {
_keyReport.keys[i] = k;
break;
}
}
if (i == 6) {
setWriteError();
return 0;
}
}
sendReport(&_keyReport);
return 1;
}
// releaseRaw() takes the specified key out of the persistent key report and
// sends the report. This tells the OS the key is no longer pressed and that
// it shouldn't be repeated any more.
size_t Keyboard_::releaseRaw(uint8_t k)
{
uint8_t i;
// Test the key report to see if k is present. Clear it if it exists.
// Check all positions in case the key is present more than once (which it shouldn't be)
for (i=0; i<6; i++) {
if (0 != k && _keyReport.keys[i] == k) {
_keyReport.keys[i] = 0x00;
}
}
sendReport(&_keyReport);
return 1;
}
size_t Keyboard_::writeRaw(uint8_t c)
{
uint8_t p = pressRaw(c); // Keydown
releaseRaw(c); // Keyup
return p; // just return the result of press() since releaseRaw() almost always returns 1
}
You would add these functions to Keyboard.cpp and modify the Keyboard class in Keyboard.h to add:
size_t writeRaw(uint8_t k);
size_t pressRaw(uint8_t k);
size_t releaseRaw(uint8_t k);
120 0x78 Keyboard Stop
121 0x79 Keyboard Again
122 0x7A Keyboard Undo
123 0x7B Keyboard Cut
124 0x7C Keyboard Copy
125 0x7D Keyboard Paste
126 0x7E Keyboard Find
127 0x7F Keyboard Mute
128 0x80 Keyboard Volume Up
129 0x81 Keyboard Volume Down
130 0x82 Keyboard Locking Caps Lock *12
131 0x83 Keyboard Locking Num Lock *12
132 0x84 Keyboard Locking Scroll Lock *12
133 0x85 Keypad Comma *27
134 0x86 Keypad Equal Sign *29
135 0x87 Keyboard International1 *15,*28
136 0x88 Keyboard International2 *16
137 0x89 Keyboard International3 *17
138 0x8A Keyboard International4 *18
139 0x8B Keyboard International5 *19
140 0x8C Keyboard International6 *20
141 0x8D Keyboard International7 *21
142 0x8E Keyboard International8 *22
143 0x8F Keyboard International9 *22
144 0x90 Keyboard LANG1 *25
145 0x91 Keyboard LANG2 *26
146 0x92 Keyboard LANG3 *30
147 0x93 Keyboard LANG4 *31
148 0x94 Keyboard LANG5 *32
149 0x95 Keyboard LANG6 *8
150 0x96 Keyboard LANG7 *8
151 0x97 Keyboard LANG8 *8
152 0x98 Keyboard LANG9 *8
153 0x99 Keyboard Alternate Erase *7
154 0x9A Keyboard SysReq/Attention *1
155 0x9B Keyboard Cancel
156 0x9C Keyboard Clear
157 0x9D Keyboard Prior
158 0x9E Keyboard Return
159 0x9F Keyboard Separator
160 0xA0 Keyboard Out
161 0xA1 Keyboard Oper
162 0xA2 Keyboard Clear/Again
163 0xA3 Keyboard CrSel/Props
164 0xA4 Keyboard ExSel
165 0xA5 Reserved
166 0xA6 Reserved
167 0xA7 Reserved
168 0xA8 Reserved
169 0xA9 Reserved
170 0xAA Reserved
171 0xAB Reserved
172 0xAC Reserved
173 0xAD Reserved
174 0xAE Reserved
175 0xAF Reserved
176 0xB0 Keypad 00
177 0xB1 Keypad 000
178 0xB2 Thousands Separator *33
179 0xB3 Decimal Separator *33
180 0xB4 Currency Unit *34
181 0xB5 Currency Sub-unit *34
182 0xB6 Keypad (
183 0xB7 Keypad )
184 0xB8 Keypad {
185 0xB9 Keypad }
186 0xBA Keypad Tab
187 0xBB Keypad Backspace
188 0xBC Keypad A
189 0xBD Keypad B
190 0xBE Keypad C
191 0xBF Keypad D
192 0xC0 Keypad E
193 0xC1 Keypad F
194 0xC2 Keypad XOR
195 0xC3 Keypad ^
196 0xC4 Keypad %
197 0xC5 Keypad <
198 0xC6 Keypad >
199 0xC7 Keypad &
200 0xC8 Keypad &&
201 0xC9 Keypad |
202 0xCA Keypad ||
203 0xCB Keypad :
204 0xCC Keypad #
205 0xCD Keypad Space
206 0xCE Keypad @
207 0xCF Keypad !
208 0xD0 Keypad Memory Store
209 0xD1 Keypad Memory Recall
210 0xD2 Keypad Memory Clear
211 0xD3 Keypad Memory Add
212 0xD4 Keypad Memory Subtract
213 0xD5 Keypad Memory Multiply
214 0xD6 Keypad Memory Divide
215 0xD7 Keypad +/-
216 0xD8 Keypad Clear
217 0xD9 Keypad Clear Entry
218 0xDA Keypad Binary
219 0xDB Keypad Octal
220 0xDC Keypad Decimal
221 0xDD Keypad Hexadecimal
222 0xDE Reserved
223 0xDF Reserved
224 0xE0 Keyboard LeftControl
225 0xE1 Keyboard LeftShift 44
226 0xE2 Keyboard LeftAlt 60
227 0xE3 Keyboard Left GUI *10;*23 127
228 0xE4 Keyboard RightControl 64
229 0xE5 Keyboard RightShift 57
230 0xE6 Keyboard RightAlt 62
231 0xE7 Keyboard Right GUI *10;*24
Footnotes:
1 Usage of keys is not modified by the state of the Control, Alt, Shift or Num Lock keys. That is, a key does not send extra codes to compensate for the state of any Control, Alt, Shift or Num Lock keys.
2 Typical language mappings: US: \| Belg: μ`£ FrCa: <}> Dan:’* Dutch: <> Fren:*μ Ger: #’ Ital: ù§ LatAm: }`] Nor:,* Span: }Ç Swed: ,* Swiss: $£ UK: #~.
3 Typical language mappings: Belg:<\> FrCa:«°» Dan:<\> Dutch:]|[ Fren:<> Ger:<|> Ital:<> LatAm:<> Nor:<> Span:<> Swed:<|> Swiss:<\> UK:\| Brazil: \|.
4 Typically remapped for other languages in the host system.
5 Keyboard Enter and Keypad Enter generate different Usage codes.
6 Typically near the Left-Shift key in AT-102 implementations.
7 Example, Erase-EazeTM key.
8 Reserved for language-specific functions, such as Front End Processors and Input Method Editors.
9 Reserved for typical keyboard status or keyboard errors. Sent as a member of the keyboard array. Not a physical key.
10 Windows key for Windows 95, and “Compose.”
11 Implemented as a non-locking key; sent as member of an array.
12 Implemented as a locking key; sent as a toggle button. Available for legacy support; however, most systems should use the non-locking version of this key.
13 Backs up the cursor one position, deleting a character as it goes.
14 Deletes one character without changing position.
15 No function
16 No function
17 No function
18 No function
19 No function
20 No function
21 Toggle Double-Byte/Single-Byte mode.
22 Undefined, available for other Front End Language Processors.
23 Windowing environment key, examples are Microsoft Left Win key, Mac Left Apple key, Sun Left Meta key
24 Windowing environment key, examples are Microsoft RIGHT WIN key, Macintosh RIGHT APPLE key, Sun RIGHT META key.
25 Hangul/English toggle key. This usage is used as an input method editor control key on a Korean language keyboard.
26 Hanja conversion key. This usage is used as an input method editor control key on a Korean language keyboard.
27 Keypad Comma is the appropriate usage for the Brazilian keypad period (.) key. This represents the closest possible match, and system software should do the correct mapping based on the current locale setting.
28 Keyboard International1 should be identified via footnote as the appropriate usage for the Brazilian forward-slash (/) and question-mark (?) key. This usage should also be renamed to either ""Keyboard Non-US / and ?"" or to ""Keyboard International1"" now that it's become clear that it does not only apply to Kanji keyboards anymore."
29 Used on AS/400 keyboards.
30 Defines the Katakana key for Japanese USB word-processing keyboards.
31 Defines the Hiragana key for Japanese USB word-processing keyboards.
32 Usage 0x94 (Keyboard LANG5) "Defines the Zenkaku/Hankaku key for Japanese USB word-processing keyboards."
33 The symbol displayed will depend on the current locale settings of the operating system. For example, the US thousands separator would be a comma, and the decimal separator would be a period.
34 The symbol displayed will depend on the current locale settings of the operating system. For example the US currency unit would be $ and the sub-unit would be ¢.