Sending numpad key codes on Seeed Sense BLE

Hello all,
Need some HID help. I am having issues sending numpad0-9 on my XIAO Sense BLE board. I am able to send 0-9 and numpad1-numpad9 using Keyboard.key_code(‘NumPad1’); but it just sends digits 0-9. I
cant seem to send the actual numpad keystrokes in Arduino

I am using the USBMousekeyboard.h

Sorry, which product(s) are you using? Would you please share the links of the XIAO sense BLE board and the keyboard that you’re using?

Hi and thank you.

I’m using the seeed sense BLE board nrf5240. I’m trying to send key strokes using the mbed usbkeyboardmouse.h library for arduino. I can send 0-9 digits but can’t send numpad0-9 specific keys no matter what I try. I also don’t see a good list of key codes for those libraries so if you can provide a list as well or link that would be great.

@Seeed_Seraphina would you kindly look into this matter?

Yes please and also if you can provide libraries for joystick as well. I would really like this to work on your boards however seems information is scattered out there with no real examples.

Hello,
there is an example of usb hid in the mbed board, which mentions two files, respectively PluggableUSBHID.h and USBKeyboard.h. Maybe you can try keyboard.ino for your project

Unfortunately these are setup issues which I don’t have. I am able to send keystrokes and mouse fine, . What I’m trying to do is specifically send numpad codes. It seems they maybe missing from your .h or .cpp files and not mapped out for the numpad. You have 0-9 all the f1-f12, modifier keys, arrow keys etc. it seems numpad keys are missing.

It seems these are missing from the USBMouseKeyboard.cpp file

{0x59, 0},          /* KeyPad_1 */
{0x5a, 0},          /* KeyPad_2 */
{0x5b, 0},          /* KeyPad_3 */
{0x5c, 0},         /* KeyPad_4 */
{0x5d, 0},          /* KeyPad_5 */
{0x5e, 0},         /* KeyPad_6 */
{0x5f, 0},         /* KeyPad_7 */
{0x60, 0},          /* KeyPad_8 */
{0x61, 0},          /* KeyPad_9 */
{0x63, 0},          /* KeyPad_0 */

For numpads. I just don’t know how to invoke these after updating the cpp file.

Do you send the Keyboard modifier first then the code for numpad key?
What about this method ?

https://www.pjrc.com/teensy/usb_keyboard.html
lots of good info , maybe you can try with seed hardware?

Projects Using Teensy Code
UnoJoy uses Teensyduino's USB code to make Arduino Uno emulate a USB joystick. The code is in "ATmega8u2Code/usb_gamepad.c".

HTH
GL :slight_smile: PJ

Thank you for the idea and keymap. I wasn’t able to use the teensy code for the SEEED BLE sense board. But I did notice missing hex maps? for numpad keys in the USBMouseKeyboard.cpp files for mbed enabled boards.

{0x59, 0},          /* KeyPad_1 */
{0x5a, 0},          /* KeyPad_2 */
{0x5b, 0},          /* KeyPad_3 */
{0x5c, 0},         /* KeyPad_4 */
{0x5d, 0},          /* KeyPad_5 */
{0x5e, 0},         /* KeyPad_6 */
{0x5f, 0},         /* KeyPad_7 */
{0x60, 0},          /* KeyPad_8 */
{0x61, 0},          /* KeyPad_9 */
{0x63, 0},          /* KeyPad_0 */

So I added these but not sure how to invoke them.

T-bones,
Crazy they are left out ? I would think something like the modifier first then the code. maybe?
Good stuff for the code bag though , sending and receiving those in both USB HID and BLE : - p
those tensy snips show what is indeed possible if only seeed pushed software support more.
it is what it is so the community picks up the slack when possible, support is amazing in supporting SO many products IMO.
HTH
GL :slight_smile: PJ

Right! I was surprised myself. My problem is that Numpad sends like ghost characters to my other opened apps and Im using it to control a radial dial written in AHK. But if I use numbers or make it more complex by adding modifiers, strange things occur. I have a teensy board and used it flawlessly to do this but wanted a BLE version and smaller footprint. I also couldn’t get Edge impulse to work either as a machine language workaround. My main reason for purchasing was the board was for numpad emulation. I hope not yet another wasted board.

I’m back to basics, looking at this:
https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardmodifiers/
the codes are there?
HTH
GL :slight_smile: PJ

Yeah im not sure what libraries they belong too but they are not working with the mbed devices. I do have an arduino leonardo and these keys work fine. Seems like they did not support numpad keys which are key! Pun intended.

These seem to just trigger numbers on the BLE Sense board and not real numpad keys.
These codes will only work if the libraries included them. USBKeyboard.h and USBMouseKeyboard.h from mbed os do not have them?

1 Like

After tinkering, I was able to find two numpad keys that work

 Keyboard.key_code(223,0);  //Numpad3

 Keyboard.key_code(225,0);  //Numpad9

But couldn’t find anymore codes to work. These codes don’t fit anything in particular? Do not appear to be ascii? 221,222, etc do not trigger any num keys.

Seems this user also ran into problems with BLE Nano 33 which is also mbed board runing same ARM processor.

It looks there is workaround this by not using the MBED version on the Arduino IDE and there fore can use Tiny USB library by adafruit and better yet the BLE52 library to get wireless keyboard and mouse.

You still have to add the hex values and key codes to he BLE52 .h files but otherwise, this works!