hello everyone... I want to make a bluetooth mouse with ESP32. only I'm still confused about creating GPIO parameters to activate the buttons on each board. can anyone help?
this is the code I use
#include <BleMouse.h>
BleMouse bleMouse;
#define Back 25
void setup() {
pinMode(Back,INPUT_PULLUP);
digitalWrite(Baack,HIGH);
Serial.begin(115200);
Serial.println("Starting BLE work!");
bleMouse.begin();
}
void loop() {
if(bleMouse.isConnected()) {
if(digitalRead(Back==LOW)){
Serial.println("Back button click");
bleMouse.click(MOUSE_BACK);
delay(500);}
}
esp32 bloetooth mouse
Re: esp32 bloetooth mouse
I can't advise on that library but I see a couple of errors in your code so try this:
- #include <BleMouse.h>
- BleMouse bleMouse;
- #define BACK 25
- void setup()
- {
- pinMode(BACK, INPUT_PULLUP);
- digitalWrite(BACK, HIGH);
- Serial.begin(115200);
- Serial.println("Starting BLE work!");
- bleMouse.begin();
- }
- void loop()
- {
- if(bleMouse.isConnected())
- {
- if(digitalRead(BACK) == LOW)
- {
- Serial.println("Back button click");
- bleMouse.click(MOUSE_BACK);
- delay(500);
- }
- }
- }
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.