5 years, 1 month ago.

Can the Microbit access USBMouse and USBKeyboard code

Hi.

I have a small project that would use an accelerometer to move the mouse around the screen. I also have 3 Microbit boards (the only boards I currently have with accelerometer) and I am a fan so I tried to implement the project on this.

I am using the online mbed compiler.

I had significant trouble getting sample accelerometer code to compile. I finally got it to work using the code from:

https://github.com/lancaster-university/microbit-samples/tree/master/source/examples/accelerometer

This is the ONLY example that compiles cleanly an runs.

So now my issue is the USB Mouse (Mouse/Keyboard HID emulation). When I go to the 'mbed' imports I cannot get it to compile. I select fix and it imports some stuff then I get different issues. I googled the results, did an update all as recommended but this dis not resolve the issue.

Can you please tell me if what I am trying is possible with the existing mbed/microbit libraries? I need both accelerometer and USBMouse/Keyboard.

I do not think I would be able to code my own USBMouse HID complient interface, I spent some time looking at the mbed code and read the HID spec and while I understand the basics it is way too complex for a beginner like me.

Please could somone assist

Regards

Stuart

1 Answer

5 years ago.

Hi Stuart,

Checking the Microbit page, it only supports Mbed OS 2.

https://os.mbed.com/platforms/Microbit/

And I am assuming you are refer USBMourse/Keyboard API here.

https://os.mbed.com/docs/mbed-os/v5.14/apis/usbmousekeyboard.html

Those APIs are supported under Mbed OS 5, so I guess that's why you are not able to build it.

A quicker way is trying to find other Mbed OS 5 supported platform with USB device function.

https://os.mbed.com/platforms/?q=&Mbed+OS+support=Mbed+OS+5.14&Communication=USB+Device

Regards, Desmond