I am looking for a USB HID library for arduino nano BLE board. I want to send keystroke through USB serial from the nano to PC. The conventional keyBoard.h library won't work on NRF52 board. I am desperately looking for a HID/Keyboard library for nRF52 board. Thank you.
Hi papuxtream. There is a library that you already have installed with the Nano 33 BLE's board package, but it doesn't seem to be very "Arduino-y":
I pulled the example program out of USBKeyboard.h:
#include "mbed.h"
#include "USBKeyboard.h"
USBKeyboard key;
int main(void)
{
while (1) {
key.printf("Hello World\r\n");
wait(1);
}
}
and it works fine. The thing you should be warned of is that after you upload this code to your Nano 33 BLE, it will no longer show up under the Tools > Port menu of the Arduino IDE. You need to press the reset button on the Nano 33 BLE twice quickly to put it in bootloader mode, then select the port from the Arduino IDE's Tools > Port menu before you can upload to it again.
I tried converting the above code into a standard Arduino sketch:
but this doesn't work and results in the 4X long, 4X short blinking LED error signal. The Nano 33 BLE prints some serial information on the pin marked "TX1" at 115200 baud when that happens, but I didn't hook up a serial adapter to see what it says.
The truth is that I'm not very experienced with the Nano 33 BLE, or Mbed in general, so I'm not able to provide much assistance on this question. But perhaps knowing about the USBHID library will be of some help to you.
You're welcome. I'm glad if I was able to be of assistance.
If you make any progress with this issue, it would be great if you'd take the time to report your findings here. I know I'd be interested to know about it, and I'm sure other Nano 33 BLE owners would too.