This library turns Arduino Board into a BLE Mouse which can be connected to devices such as Windows PC, android phones etc. This library is completely written using Mbed OS's BLE API and also supports pairing with the Central device.
This library is similar to the Arduino's Mouse library and supports all the functions which are in the mouse library. It also has additional features such as setDeviceName, setManufacturerName and setBatteryLevel.
#include <HIDMouse.h>
HIDMouse bleMouse;
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
bleMouse.setDeviceName("Device");
bleMouse.setManufacturerName("Manufacturer");
bleMouse.setBatteryLevel(75);
bleMouse.begin();
}
void loop() {
while(bleMouse.isConnected()) {
digitalWrite(LED_BUILTIN, HIGH);
bleMouse.move(0,0,1);
delay(1000);
}
digitalWrite(LED_BUILTIN, LOW);
}
- Arduino Nano BLE
- Arduino Nano BLE Sense
- Any board with Mbed OS and BLE support.
- Choose
Tools->Manage Libraries->Mbed BLE Mouse
cd ~/Documents/Arduino/libraries/
git clone https://github.com/csash7/mbed-BLE-MouseSee examples folder.
This library is licensed under the APACHE Licence.