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);
}
Any board with Mbed OS and BLE support.
Tools
-> Manage Libraries
-> Mbed BLE Mouse
cd ~/Documents/Arduino/libraries/
git clone https://github.com/csash7/mbed-BLE-Mouse
See examples folder.
This library is licensed under the APACHE Licence.