How do I compare and save data from bluetooth?

Hi I have been stuck on this for a couple of days. I want to compare incoming data to already stored data and if it is different, update the database and then display the saved data.
The blocks I have work fine for one piece of data but as soon as I add another it breaks somehow.

I believe it is something to do with the clock timer, because the value will stay on screen if it's just one piece of data but as soon as I add another it only stays on the screen for the period I have set the timer.

I can receive and display data from arduino no problems, just comparing and saving giving me problems

.

try moving the block (call Update_All_Values​​3) inside Compare_to_Database3
For Example :

if Temp_RPM ≠ global RPM
then
[call Database .StoreValue]
[call Update_All_Values​​3]

1 Like

That works for the one value but as soon as I call compare_to_database in the second if/then it's the same problem. I also tried moving the compare_to_database outside the if/thens that replace the text and outside the receive bytes but that returns nothing.

1 Like

do you mean you just got value from RPM and Gain not give you any value?

1 Like

Yep, just blank in the text field.
If i call compare_to_database in each if/then the text is displayed but only for the length of the timer.
If i change the length of the timer the data is displayed for that length.

Is DelimiteByte = 10 set?

What is the transmitter code like?

Delimiter is 10.
Thanks for making me look at the code again though, I was using \n to separate the values but that being the delimiter was causing the problem I believe.

I've changed the code and app and this seems to be working.

Code: (this obviously isn't my whole code, just the sending part)
BTserial.print("R");
BTserial.print(rpm);
BTserial.print("|");
BTserial.print("G");
BTserial.print(gain);
BTserial.println("\n");

The character i send before the value is just an identifier.

Here are the app blocks, short version, have tested these with 5 values so far.

Next question, is it best practice to clear globals and tags in database before replacing them or can I just write directly over them?

Thanks for the help

Another idea would be to save time, RPM and Gain.

BTW, about println()

print("one"); ------> one

println("one"); ------> one\r\n

println(); ------> \r\n

print("one");
print("\n"); -----> one\n

\n is 10 in ASCII hex.

Been working all day so my brain is a bit fried.
What your saying is the \n is redundant if I'm using println?

println("\n") -----> \n\r\n

try:

BTserial.println(gain);
// BTserial.println("\n");

I assume that your BTserial works the same as Serial.

If you decide to save your data in a list for graphing it over time, see

Ah I see, thanks. Yep that's just the name i gave to the software serial on the arduino.

Thanks, will keep that in mind for future. Mostly just saving the values now so they persist each time the app starts