I am currently using USBkeyboard.h to try to send keyboard signals from the nano 33 BLE sense board. What I need is the keys on the numpad, but I still can’t send them after many attempts.
I just tested the example on a Windows 10 PC and even connected to a Raspberry Pi with the official Pi OS. After replacing the ThisThread::sleep with delay() the sketch does exactly what it should.
Could you please post your code (use code tags) and describe what does not work and what exactly do you want to type? You just mentioned keys on numpad. They have multiple assignments.
Can you confirm that you can get your sketch to enumerate as a keyboard and print characters? Your sketch does not work on my system and as far as I know should not work.
Once your Arduino works as a keyboard you cannot use Serial anymore and therefore your sketch should not be able to run beyond while(!Serial);
Also, I believe for some reason (maybe USB initialization) you cannot use setup() and loop(). My sketch only works with main() like the original example from the mbedOS documentation.
What OS are you using on your PC?
Do you care about numpad key codes (if there is such a thing) or do you just want to use the functions like arrow down?
I added some code to my sketch and successfully used Arrow, CTRL and SHIFT. e.g.
keyboard.key_code( 'c', KEY_CTRL ); // CTRL + C copy
keyboard.key_code( KEY_HOME, KEY_SHIFT ); // mark text from current cursor to beginning of line
keyboard.key_code( RIGHT_ARROW );
You can find more information in the USBKeyboard .h and .cpp source files.
I need to send numpad keys because it's for customer's application.
Today I use USBMouse.h as an alternative and found it work for the app, I will update this post if I get the solution of keyboard, thank for your help.