Krolyxon
Commit 1d55752

Branches

Tags

Refs →

orion-rf.piolibdepsesp32-s3-n16r8ESP32 BLE MouseexamplesMouseButtonsMouseButtons.ino

45 lines · 1.0 KB

1/**
2 * This example turns the ESP32 into a Bluetooth LE mouse that continuously moves the mouse.
3 */
4#include <BleMouse.h>
5
6BleMouse bleMouse;
7
8void setup() {
9 Serial.begin(115200);
10 Serial.println("Starting BLE work!");
11 bleMouse.begin();
12}
13
14void loop() {
15 if(bleMouse.isConnected()) {
16 Serial.println("Left click");
17 bleMouse.click(MOUSE_LEFT);
18 delay(500);
19
20 Serial.println("Right click");
21 bleMouse.click(MOUSE_RIGHT);
22 delay(500);
23
24 Serial.println("Scroll wheel click");
25 bleMouse.click(MOUSE_MIDDLE);
26 delay(500);
27
28 Serial.println("Back button click");
29 bleMouse.click(MOUSE_BACK);
30 delay(500);
31
32 Serial.println("Forward button click");
33 bleMouse.click(MOUSE_FORWARD);
34 delay(500);
35
36 Serial.println("Click left+right mouse button at the same time");
37 bleMouse.click(MOUSE_LEFT | MOUSE_RIGHT);
38 delay(500);
39
40 Serial.println("Click left+right mouse button and scroll wheel at the same time");
41 bleMouse.click(MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE);
42 delay(500);
43
44 }
45}