Arduino nano 33 BLE - Air mouse - NO HID function ?

Hi,

I am using an Arduino nano 33 ble to create a air mouse. But when i try to include librairies with HID function it returns me an error as USB MCU is not available.

However when i look at the following link : https://www.arduino.cc/en/Guide/NANO33BLESense

" the Arduino NANO 33 BLE Sense as a client USB peripheral (acting as a mouse or a keyboard connected to the computer) or as a USB host device so that devices like a mouse, keyboard, or an Android phone can be connected to the Arduino NANO 33 BLE. "

So here is my question, do you have any idea how i can play with Mouse.h / Keyboard.h with this board ?

Thank you :slight_smile:

If the USB connector is involved, the firmware for that (now serial) port has to be replaced by HID master or slave code. Afterwards the Nano cannot be programmed any more from that USB port, perhaps by BT?

I'm here for the same problem, have you find something intresting about it?

Arduino hasn't provided support for the standard Mouse or Keyboard libraries on the Nano 33 BLE boards yet, but there is a USBHID library that provides the similar functionality, albeit in a not very "Arduino-y" manner. I have documented my experience with the keyboard emulation of that library here:

The library also has mouse emulation functionality. You can see the API here:

The comments in that file provide an example program:

#include "mbed.h"
#include "USBMouse.h"

USBMouse mouse;

int main(void)
{
  while (1)
  {
     mouse.move(20, 0);
     wait(0.5);
  }
}

Once you upload that mouse example sketch to your Nano 33 BLE a port will no longer be available for the board in the Arduino IDE's Tools > Port menu. In order to upload a new sketch to your Nano 33 BLE, press the reset button on the board twice quickly. You will see the onboard "L" LED start pulsing. This means the board is in bootloader mode. You can now select its port from the Arduino IDE's Tools > Port menu and upload to it.

DrDiettrich:
If the USB connector is involved, the firmware for that (now serial) port has to be replaced by HID master or slave code. Afterwards the Nano cannot be programmed any more from that USB port, perhaps by BT?

You can just do the double reset trick I described above.