1 year, 4 months ago.

Can the Microbit access USBMouse and USBKeyboard code


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:


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



1 Answer

1 year, 3 months ago.

Hi Stuart,

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


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


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.


Regards, Desmond