This library allows you to make the ESP32 act as a Bluetooth keyboard and mouse with Arduino.
#include <BleCombo.h>
void setup() {
Serial.begin(115200);
Serial.println("Starting work!");
Keyboard.begin();
Mouse.begin();
}
void loop() {
if(Keyboard.isConnected()) {
Serial.println("Sending 'Hello world'");
Keyboard.println("Hello World");
Serial.println("Sending Enter key...");
Keyboard.write(KEY_RETURN);
Serial.println("Sending Play/Pause media key...");
Keyboard.write(KEY_MEDIA_PLAY_PAUSE);
Serial.println("Sending Ctrl+Alt+Delete...");
Keyboard.press(KEY_LEFT_CTRL);
Keyboard.press(KEY_LEFT_ALT);
Keyboard.press(KEY_DELETE);
delay(100);
Keyboard.releaseAll();
Serial.println("Move mouse pointer up");
Mouse.move(0,-10);
Serial.println("Scroll Down");
Mouse.move(0,0,-1);
Serial.println("Left click");
Mouse.click(MOUSE_LEFT);
}
Serial.println("Waiting 2 seconds...");
delay(2000);
}
This is fork of @T-kV's excellent ESP32-BLE-Mouse and ESP32-BLE-Keyboard libraries.
You might also be interested in: