-
Notifications
You must be signed in to change notification settings - Fork 531
Description
I'd like to emulate the R key on a Mac keyboard using a button and an M5StickC PLUS2 ESP32 with Arduino.
I asked my friend ChatGPT how to do it, and here's what he told me.
So I installed all the necessary libraries.
ESP32-BLE-Keyboard
I connected my M5StickC PLUS2 via USB to my Mac to connect it to my Arduino IDE.
I then transferred my code from Arduino to my board, but I have this error!
`c:\Users\Cl�ment\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp: In member function 'void BleKeyboard::begin()':
c:\Users\Cl�ment\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp:106:19: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string'} to 'String'
106 | BLEDevice::init(deviceName);
| ^~~~~~~~~~
| |
| std::string {aka std::__cxx11::basic_string}
In file included from C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEServer.h:26,
from C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEService.h:25,
from C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEHIDDevice.h:21,
from c:\Users\Cl�ment\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.h:24,
from c:\Users\Cl�ment\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp:1:
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEDevice.h:184:27: note: initializing argument 1 of 'static void BLEDevice::init(String)'
184 | static void init(String deviceName);
| ~~~~~~~^~~~~~~~~~
c:\Users\Cl�ment\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp:117:32: error: no matching function for call to 'BLECharacteristic::setValue(std::string&)'
117 | hid->manufacturer()->setValue(deviceManufacturer);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLEHIDDevice.h:20:
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:193:8: note: candidate: 'void BLECharacteristic::setValue(const uint8_t*, size_t)'
193 | void setValue(const uint8_t *data, size_t size);
| ^~~~~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:193:8: note: candidate expects 2 arguments, 1 provided
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:194:8: note: candidate: 'void BLECharacteristic::setValue(const String&)'
194 | void setValue(const String &value);
| ^~~~~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:194:31: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'const String&'
194 | void setValue(const String &value);
| ~~~~~~~~~~~~~~^~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:195:8: note: candidate: 'void BLECharacteristic::setValue(uint16_t)'
195 | void setValue(uint16_t data16);
| ^~~~~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:195:26: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'uint16_t' {aka 'short unsigned int'}
195 | void setValue(uint16_t data16);
| ~~~~~~~~~^~~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:196:8: note: candidate: 'void BLECharacteristic::setValue(uint32_t)'
196 | void setValue(uint32_t data32);
| ^~~~~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:196:26: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'uint32_t' {aka 'long unsigned int'}
196 | void setValue(uint32_t data32);
| ~~~~~~~~~^~~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:197:8: note: candidate: 'void BLECharacteristic::setValue(int)'
197 | void setValue(int data32);
| ^~~~~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:197:21: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'int'
197 | void setValue(int data32);
| ~~~~^~~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:198:8: note: candidate: 'void BLECharacteristic::setValue(float)'
198 | void setValue(float data32);
| ^~~~~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:198:23: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'float'
198 | void setValue(float data32);
| ~~~~~~^~~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:199:8: note: candidate: 'void BLECharacteristic::setValue(double)'
199 | void setValue(double data64);
| ^~~~~~~~
C:\Users\Cl�ment\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\BLE\src/BLECharacteristic.h:199:24: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string'} to 'double'
199 | void setValue(double data64);
| ~~~~~~~^~~~~~
grpc: error while marshaling: string field contains invalid UTF-8
Compilation error: grpc: error while marshaling: string field contains invalid UTF-8`
It seems to be coming from the BleKeyboard library.
Do you have any ideas or solutions to help me emulate the R key on a Mac keyboard with an M5StickC PLUS2?