I’m trying to send data (a color) from react native app to TTGO microcontroller using BLE.
Sometimes it works and sometimes I get this error:
[BleError: Cannot write to characteristic beb5483e-36e1-4688-b7f5-ea07361b26a8 with invalid data format: [r,g,b]]
Can somebody help me?
I tried so many things. ASCII, Uint8array, Textencoder, base64 but that wouldn’t work in React-native
When I send purple is does work, but when I try to send green, red, blue, orange, pink or yellow it doesn’t work. Probably because purple doesn’t have 255 in the rgb information. But it can be something else.
Right now im using JSON.stringify for the data format to be a string and I’m using:
await connectedDevice.writeCharacteristicWithResponseForService(
TTGO_T_DISPLAY_UUID,
TTGO_T_DISPLAY_Characteristic_UUID,
base64Data
);
to send the data
Simeon_h is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1