Hello here, I am new to this site. Currently I am trying to achieve something described already here. I am using two Arduino BLEs. The first one is peripheral (1), the second one should be peripheral and central simultaneously (2), which then can be connected to another device, like an iphone (3).
Now I am stuck with the problem, that I can't read the value from the peripheral (1) into my central (2). Therefore I am trying to use the bleCharacteristic.readValue() method. But I don't get it to work, I just get a value either "1" or "4" depending which variables I write for the readValue() method.
Snippet from my function:
BLECharacteristic ValueX = peripheral.characteristic("8234d84");
if (!ValueX) {
Serial.println("Peripheral does not have ValueX characteristic!");
peripheral.disconnect();
return;
}
while (peripheral.connected() && central.connected()) {
byte buffer[4];
NValueX.writeValue(String(ValueX.readValue(buffer, 4)));
}
From other posts in the forum I got the info, that a byte array is parsed, not the actual value. But even here the length of it is just one. nRF Apps stated 34, "4".
Does someone know how I can parse the value from peripheral to central and how to decode the information?