Home

Awesome

ESP32 BLE Abs Mouse library

This library allows you to make the ESP32 act as a Bluetooth Absolute Mouse and control what it does. E.g. click, move, release and etc.

You might also be interested in:

Features

Installation

Examples

#include <BleAbsMouse.h>

BleAbsMouse bleAbsMouse;

void setup() {
  bleAbsMouse.begin();
}

void loop() {
  if(bleAbsMouse.isConnected()) {
    bleAbsMouse.click(5000, 5000);
  }
  delay(2000);
}

Check examples for concrete examples.

API docs

// Use 0 up to 10000 to represent:
//   x: from left to right
//   y: from top to bottom
bleAbsMouse.click(x,y);

// If you want to click and stay clicked, use move instead:
bleAbsMouse.move(x,y);

// Since move keeps the finger as pressed, you need to release it when convenient
bleAbsMouse.release();

There is also Bluetooth specific information that you can use (optional):

Instead of BleAbsMouse bleAbsMouse; you can do BleAbsMouse bleAbsMouse("Bluetooth Device Name", "Bluetooth Device Manufacturer", 100);.

The third parameter is the initial battery level of your device. To adjust the battery level later on you can simply call e.g. bleAbsMouse.setBatteryLevel(50) (set battery level to 50%). By default the battery level will be set to 100%, the device name will be ESP32 Bluetooth Abs Mouse and the manufacturer will be Espressif.

Credits

Credits to T-vK as this library is based on ESP32-Ble-Mouse that he created.