Hello, I am trying to transfer data from a BLE 33 Sense (BLE peripheral, let's call it TX board) to a BLE 33 IoT (Central, let's call it RX board).
Particularly I am using a simple variable for float (axis X of 33 Sense gyroscope), on ArduinoBLE.h library type is BLEFloatCharacteristics
I am quite sure that:
- TX and RX are connected;
- TX is sending data
- RX identifies the specific charateristic
but I cannot print received value on Serial, since I have or NULL or 0 value printed, or conversion issues and errors.
Below there is the CENTRAL (RX) part of code not working and I can't resolve.
// retrieve the GYRO characteristic
if(DEBUG){Serial.println("DEBUG retrieve the GYRO characteristic");}
BLECharacteristic gyro_ch_x = peripheral.characteristic("ce7b9417-7860-42d0-87b5-9e35ec8dd241");
if (!gyro_ch_x)
{
if(DEBUG){Serial.println("DEBUG gyro_ch_x ESISTE");}
Serial.println("Peripheral does not have gyro_ch_x characteristic!");
peripheral.disconnect();
return;
// COMMENT: this message has never been printed out, so I am quite sure gyro_ch_x is detected!
}
// while the peripheral is connection
Serial.println(gyro_ch_x.read());
//Serial.println("GyroX=" + gyro_ch_x.value());
At the end I have null value; I tried also to cast gyro_ch_x in a float variable, but it seems it always a BYTE variable with 0 value.
I'm not an experienced programmer, anyway I didn't find in any forum or documentation full example of such code apart from simple int or boolean variable.
I need a float value.
May anyone help me?
Thanks in advance!
GB