0xFD [modifiers] 0x00 [keycode1] [keycode2] [keycode3] [keycode4] [keycode5] [keycode6]
...the tutorial says:
I worked with straight USB keyboard HID, but not Bluetooth. What is releasing the KEY_A (4) and KEY_B (5) -- is that (0, 0, 0)? If so, does this mean the six key code slots in the Bluefruit EZ-Key are tied to whatever KEY_DOWN they first sent? (No more than 6 depressed at the same time?)Here is the Arduino function we use to send a raw keyCommand. For example if you want to send the keystroke for the letter 'a' (no shift) you'll want to call
keyCommand(0, 4);
to press the keycode 4 ('a') followed by a release
keyCommand(0, 0);
if you want to press 'a' and 'b' at the same time, send
keyCommand(0, 4, 5);
for keycodes 4 and 5 at the same time. You can send up to 6 consecutive keys at once, don't forget to send the release 'key up' command or the key will be 'stuck'!
Suppose I wanted to hold down a key, then press and release a few keys with delays in between, then release the first key at the end. On Arduino, it might look like this:
Code: Select all
// Hold down LEFT SHIFT
Keyboard.press(KEY_LEFT_SHIFT); // press SHIFT
delay(1000);
Keyboard.press('a'); // press a
delay(1000);
Keyboard.release('a'); // release a
Keyboard.press('b');// press b
delay(1000);
Keyboard.release('b'); // release b
delay(1000);
Keyboard.release(KEY_LEFT_SHIFT); // release SHIFT
Code: Select all
keyCommand(MODIFIER_SHIFT_LEFT); // press shift
delay(1000);
// ???
keyCommand(MODIFIER_SHIFT_LEFT, KEY_A); // press shift+a
delay(1000);
keyCommand(MODIFIER_NONE, KEY_A); // release shift+a
delay(1000);
// ???
keyCommand(MODIFIER_SHIFT_LEFT, KEY_B); // press shift+b
delay(1000);
keyCommand(MODIFIER_NONE, KEY_B); // release shift+b
delay(1000);
// release shift here...
I expect this is quite simple, and I am just being confused by the example.
(For my actual application, I am not sending shift and such, but might be holding down '1' and then pressing and releasing 'a' then 'x' then 'y' and then releaseing the '1' -- that type of thing.)
Thanks.