I want to use a Leonardo with USB chip to emit some commands via USB port to a digital piano computer (running Windows 7) for various functions. I've gotten the Leonardo to emit page up and page down functions using a simple project I found on the web. What I need now is the following set of functions: left arrow, right arrow, F11, wake, and sleep. What I need help with is:

  • where is the complete list of functions available with keyboard.press?
  • are wake and sleep among those available?
  • if they aren't, what header file could be modified to include them?

Thank you for any suggestions.

  • google keyboard scan codes
    – jsotola
    Commented Jan 15, 2021 at 0:06
  • Thank you, I have the needed scan codes. What I need is information about where to put them in the IDE. Commented Jan 15, 2021 at 0:12
  • you said that you are able to generate PgUp and PgDn keypresses .... you do other keypresses the same way
    – jsotola
    Commented Jan 15, 2021 at 0:21
  • The functions for keyboard.press (RIGHT-ARROW) and left arrow work as expected. F11, WAKE and SLEEP are not available or are not named that way, hence my questions about the list of available functions, or what the header file is named so that I can add to it. Commented Jan 15, 2021 at 0:37
  • names like RIGHT-ARROW and F11 are just numbers ... i would suspect that they are scan codes ... i would just use a scancode for PgDn to see if my hunch is correct
    – jsotola
    Commented Jan 15, 2021 at 0:41

1 Answer 1


It turns out there is a library that can be added to compile the media and system functions for USB keyboard connection into the Leonardo, as well as other Arduino modules. It is available through 'tools','library manager'; it is HID-project by NicoHood. There is an example program called "system example" at github to test it for for wake and sleep. It works perfectly. I expect it'll work for the other functions too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.