Bugfix: Compilation fails using Keyboard.press(...)

egonuel

New member
Hi there,

I just received my first teensy and sofar im quite impressed how fast and easy one can do stuff, really cool :)
After the first blinking LEDs and pushing buttons, I'm trying to use it as a USB keyboard.
Using Keyboard.press(...) produces the following error while compiling:
Code:
usb_keyboard.c.o: In function `usb_keyboard_press_keycode':
C:\arduino-1.0.3\hardware\teensy\cores\teensy3/usb_keyboard.c:240: undefined reference to `send_now'
collect2.exe: error: ld returned 1 exit status

The c-function usb_keyboard_press_keycode(...), which is invoked by usb_keyboard_class::press(...), tries to use send_now(), which is part of the class.
Being in the wrong scope, this produces an the error above. Simply exchanging send_now() with the c-function usb_keyboard_send(), which is called by send_now() anyway, solves the problem.
As other people seem to be able to use it out of the box without an error, this is maybe some platform specific thing. Mine is Win7 x64 with a Teensy 3.0 using Arduino 1.0.3 and the latest Teensyduino 1.12.

Greetings
 
okay as I'm continuing my journey through keyboard land, I got the next bug:
Keyboard.releaseAll() produces a similar error. This time it is not defined at all.
I added this in usb_keyboard.h:
Code:
void releaseAll(void) [COLOR="#008080"]{ usb_keyboard_release_all(); }[/COLOR]
 
Back
Top