Hi, I want to parse Bluetooth data coming from Arduino to 9 separate textboxes. But, it seems the data packet isn't received as a whole, so the app can't parse the the data and gives some errors. I've used \n symbol (newline in ascii is 10) as delimiter byte for Bluetooth, but it didn't solve the problem.
The problem isn't related to Arduino because I can see on com port data coming from Arduino is like this:
#1,0.16,0.00,0.00,0.00,-2,0.13,3,1000.00$ #1,0.05,0.00,0.00,0.00,-2,0.11,5,1000.00$ #1,0.43,0.00,0.00,0.00,-2,0.11,7,1000.00$ #1,0.49,0.00,0.00,0.00,-2,0.05,9,1000.00$ #1,0.38,0.00,0.00,0.00,-2,0.14,11,1000.00$ #1,0.27,0.00,0.00,0.00,-2,0.20,13,1000.00$ #1,0.22,0.00,0.00,0.00,-2,0.11,15,1000.00$ #1,0.16,0.00,0.00,0.00,-2,0.09,17,1000.00$
Here is my aia project: https://drive.google.com/file/d/1_FBWcWqHqa9w0EOUIblsU-F-sYnBRpSX/view?usp=sharing
My Arduino code is pretty complex, so I'm sharing one piece of it where I send the data packet to the app:
void serialSendPkg()
{
if ((currentMillis - lastMillis) >= delayTime)
{
String dataToSend = "";
//send package begin
dataToSend += '#';
dataToSend += String(device_state);
dataToSend += (",");
dataToSend += String(printVoltage);
dataToSend += (",");
dataToSend += String(printCurrent);
dataToSend += (",");
dataToSend += String(printResistance);
dataToSend += (",");
dataToSend += String(printCapacitance);
dataToSend += (",");
dataToSend += String(pwr_state);
dataToSend += (",");
dataToSend += String(pwr_voltage);
dataToSend += (",");
dataToSend += String(testCounter);
dataToSend += (",");
dataToSend += String(delayTime + delayWhileSending);
testCounter += 1;
if (testCounter > 64000)
{
testCounter = 0;
}
dataToSend += ("$");
Serial.println(dataToSend);
dataToSend = "";
//send package end
lastMillis = currentMillis;
}
}
Thanks before.