Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

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

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    2

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

    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

  2. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    2
    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) { usb_keyboard_release_all(); }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •