Hello,
I have some issues sending valid information to nRF Connect app by bluetooth using the Aduino Nano 33 BLE with nRF52840 on it. I am using Arduino IDE and the ArduinoBLE library
On the Example the characteristic is set in this way:
//BLEUnsignedCharCharacteristic HeartbeatdataChar("2A37", // standard 16-bit characteristic UUID
// BLERead | BLENotify); // remote clients will be able to get notifications if this characteristic changes
to send the data to the app
for(int i=0; i < 250; i++){
int heartRatedata = map(Qdata[i], 0, 1023, 0, 254);
Serial.println(heartRatedata);
//const unsigned char heartRateCharArray[2] = { 0, (char)heartRatedata };
//HeartbeatdataChar.setValue(heartRateCharArray,2);
HeartbeatdataChar.setValue((char)heartRatedata);
}
but it present an invalid value
I also try change characteristic to other format like
BLEIntCharacteristic HeartbeatdataChar("2A37", // standard 16-bit characteristic UUID
BLERead | BLENotify); //
And I tried to send directly an integer number with the same results
for(int i=0; i < 250; i++){
int heartRatedata = map(Qdata[i], 0, 1023, 0, 254);
//int dataQ[4]={heartRatedata,23,45,24};
Serial.println(heartRatedata);
HeartbeatdataChar.setValue(heartRatedata);
}
In this case I noticed that maybe I need to send an array but the function setValue and writeValue of the ArduinoBLE do not allowed these options in these functions
this way to send data give me an error trying to compliling the sketch on Arduino.
const unsigned char heartRateCharArray[2] = { 0, (char)heartRatedata };
HeartbeatdataChar.setValue(heartRateCharArray,2);
Please, could you help me to fix this issues to send valid data ?
Regards,
Heiner