I've built this thingy:http://www.practicalarduino.com/projects/virtual-usb-keyboard
and it works a treat, but I want to send a character with 2 control codes, and that doesn't work.
For example shift + ctrl + x.
UsbKeyboard.sendKeyStroke(KEY_B,MOD_CONTROL_LEFT) works, but
UsbKeyboard.sendKeyStroke(KEY_B,MOD_CONTROL_LEFT, KEY_ARROW_LEFT) does not work, and I get the following error message:
UsbKeyboardtest.ino: In function 'void loop()':
UsbKeyboardtest:41: error: no matching function for call to 'UsbKeyboardDevice::sendKeyStroke(int, int, int)'
D:\arduino-1.0.5-r2\libraries\UsbKeyboard/UsbKeyboard.h:153: note: candidates are: void UsbKeyboardDevice::sendKeyStroke(byte)
D:\arduino-1.0.5-r2\libraries\UsbKeyboard/UsbKeyboard.h:157: note: void UsbKeyboardDevice::sendKeyStroke(byte, byte)
I think it's got something to do with the following in Usbkeyboard.h:
void sendKeyStroke(byte keyStroke) {
sendKeyStroke(keyStroke, 0);
}
void sendKeyStroke(byte keyStroke, byte modifiers) {
while (!usbInterruptIsReady()) {
// Note: We wait until we can send keystroke
// so we know the previous keystroke was
// sent.
}
memset(reportBuffer, 0, sizeof(reportBuffer));
reportBuffer[0] = modifiers;
reportBuffer[1] = keyStroke;
I have already tried a few things, but my knowledge of C++ is very minimal, so it doesn't surprise me that it doesn't work. I need to add an extra modifier.
The only thing I want, is to send a ctrl + uppercase character, but since the HID tables only has lowercase, I need to send a shift too, and that's where it goes wrong.
I have only posted snippets of the code, I assume that others are in the know about this project.