Hello everyone,
I am trying to compile the BLE Mouse code from the below repo-
BLE MOuse repo
The basic code example is -
/**
* This example turns the ESP32 into a Bluetooth LE mouse that scrolls down every 2 seconds.
*/
#include <BleMouse.h>
BleMouse bleMouse;
void setup() {
Serial.begin(115200);
Serial.println("Starting BLE work!");
bleMouse.begin();
}
void loop() {
if(bleMouse.isConnected()) {
Serial.println("Scroll Down");
bleMouse.move(0,0,-1);
}
delay(2000);
}
The selected board is
XIAO_ESP32C3
I am getting a compilation error-
C:\Users\usr\OneDrive\Documents\Arduino\libraries\ESP32-BLE-Mouse\BleMouse.cpp: In static member function 'static void BleMouse::taskServer(void*)':
C:\Users\usr\OneDrive\Documents\Arduino\libraries\ESP32-BLE-Mouse\BleMouse.cpp:143:37: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'String'
143 | BLEDevice::init(bleMouseInstance->deviceName);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
| |
| std::string {aka std::__cxx11::basic_string<char>}
In file included from C:\Users\usr\OneDrive\Documents\Arduino\libraries\ESP32-BLE-Mouse\BleMouse.cpp:1:
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLEDevice.h:41:27: note: initializing argument 1 of 'static void BLEDevice::init(String)'
41 | static void init(String deviceName); // Initialize the local BLE environment.
| ~~~~~~~^~~~~~~~~~
C:\Users\usr\OneDrive\Documents\Arduino\libraries\ESP32-BLE-Mouse\BleMouse.cpp:151:50: error: no matching function for call to 'BLECharacteristic::setValue(std::string&)'
151 | bleMouseInstance->hid->manufacturer()->setValue(bleMouseInstance->deviceManufacturer);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLEServer.h:23,
from C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLEDevice.h:21:
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:77:8: note: candidate: 'void BLECharacteristic::setValue(uint8_t*, size_t)'
77 | void setValue(uint8_t *data, size_t size);
| ^~~~~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:77:8: note: candidate expects 2 arguments, 1 provided
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:78:8: note: candidate: 'void BLECharacteristic::setValue(String)'
78 | void setValue(String value);
| ^~~~~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:78:24: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'String'
78 | void setValue(String value);
| ~~~~~~~^~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:79:8: note: candidate: 'void BLECharacteristic::setValue(uint16_t&)'
79 | void setValue(uint16_t &data16);
| ^~~~~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:79:27: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'uint16_t&' {aka 'short unsigned int&'}
79 | void setValue(uint16_t &data16);
| ~~~~~~~~~~^~~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:80:8: note: candidate: 'void BLECharacteristic::setValue(uint32_t&)'
80 | void setValue(uint32_t &data32);
| ^~~~~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:80:27: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'uint32_t&' {aka 'long unsigned int&'}
80 | void setValue(uint32_t &data32);
| ~~~~~~~~~~^~~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:81:8: note: candidate: 'void BLECharacteristic::setValue(int&)'
81 | void setValue(int &data32);
| ^~~~~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:81:22: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int&'
81 | void setValue(int &data32);
| ~~~~~^~~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:82:8: note: candidate: 'void BLECharacteristic::setValue(float&)'
82 | void setValue(float &data32);
| ^~~~~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:82:24: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'float&'
82 | void setValue(float &data32);
| ~~~~~~~^~~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:83:8: note: candidate: 'void BLECharacteristic::setValue(double&)'
83 | void setValue(double &data64);
| ^~~~~~~~
C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE\src/BLECharacteristic.h:83:25: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'double&'
83 | void setValue(double &data64);
| ~~~~~~~~^~~~~~
Using library ESP32-BLE-Mouse at version 0.3.1 in folder: C:\Users\usr\OneDrive\Documents\Arduino\libraries\ESP32-BLE-Mouse
Using library BLE at version 2.0.0 in folder: C:\Users\usr\OneDrive\Documents\ArduinoData\packages\esp32\hardware\esp32\3.0.0\libraries\BLE
exit status 1
Error compiling for board XIAO_ESP32C3.
I’d appreciate your help resolving this.
Thanks in advance.