Help with string search

I am receiving a string via blutooth and if the string is a certain word I want to change the colour of the text box.

If it is any other word i want to change the text displayed and the colour.

There is obviously something wrong with these blocks as they dont 'find' NEUTRAL

My string is received in received_data4 field which I know is working if I just display the field.

Your current 'if' will work for an identical match, that is, if the received string and the "test" string match:

NEUTRAL = NEUTRAL
Neutral = Neutral

Ensure that 'splitdata' is a List, has the correct number of indexes and your code is selecting the correct index. (Use 'Do It')

Another way is to use the Text Comparison Block - which does not require the data to be split into a List (but you can test List Items with it if required).

Snap4

Chris

Thanks. I inserted the IF block into the main code and again I know I am receiving NEUTRAL but the IF doesnt seem to work??

Maybe your NEUTRAL message is immediately followed by another message without NEUTRAL, wiping away the results of the NEUTRAL message?

Add a logger procedure to capture all incoming messages.

... you only need to check the length of the List once! If it is incorrect, that is a data receive fail, end of.

Can we see your Script that formats the data from the BT device?

Script is below.....I start with casting some floats

int battv;
int tempv;
int fuelv;
String gearv ;
battv = (int)batteryVolts;
tempv = (int) oledTemp;
fuelv = (int) litres;

if ( ipArray [6] == LOW ) {
gearv = "NEUTRAL";
}

if (millis() - igUpdateTime > 500)
{
batteryRead();
watertemp();
igUpdateTime = millis();

Serial1.print (battv );
Serial1.print ("|");
Serial1.print (tempv);
Serial1.print ("|");
Serial1.print (fuelv);
Serial1.print ("|");
Serial1.print (gearv);
Serial1.println();

}

Well, there are too many holes in there for that to be your Sketch!

At least we can see that the packet stream is well assembled.

There are missing Blocks in your App Inventor Code:

Snap6

...and you have not initialised the incoming data to a List: