I have a question about this faq https://www.arduino.cc/en/Reference/CurieBLE; i don't understand when it says that i can "combine readings into a single characteristic";
if i read data with CurieIMU.readAccelerometer(axRaw, ayRaw, azRaw);
how can i combine them to send just a BLE packet?
Because i have a code where i send a packet for every axis, but i want to optimize it sending just a packet with the 3 values.
Thanks
I have found a way, but i have a problem and i hope you can help me.
The code is quite simple:
String packacc;
int axRaw, ayRaw, azRaw; // raw accelerometer value
float axc, ayc, azc; //raw float acc conversion
String axs, ays, azs; //raw string acc conversion
CurieIMU.readAccelerometer(axRaw, ayRaw, azRaw);
axs = String(axRaw);
ays = String(ayRaw);
azs = String(azRaw);
packacc += axs;
packacc += ays;
packacc += azs;
char pacc[15];
packacc.toCharArray(pacc,15);
The problem is the following: when i try to pass the value to the BleCharacteristic in this way
imuAccCharacteristic.setValue(pacc);
it gives me this error
invalid conversion from char* to char; how can i solve it?
If i write
imuAccCharacteristic.setValue(*pacc);
it doesn't give me errors, but i don't think it passes all the values i need
I have you can help me
I've a similar problem. I "stored" different values in a char array and tried to send them to my Android-phone via BLE:
char a [20];
String val = "val,";
val.toCharArray(a,20);
Serial.println(a);
TxVal.setValue(*a);
but I don't receive any data on my phone. I guess this code doesn
t work.
Maybe someone can show ilpigna and me how to solve this problem.