Hello. I am creating a program to remotely control an arduino relay. I use BLE extension. I have everything working now, but I want to improve something. The question is how to compare the received data (String) with the known string.
My arduino sends the string: "a11". This is implemented as follows:
Serial.print("a11");
In the Android program, I received it and display it on the screen:
In my program it looks like this:
But I want to compare the received String with the one known in the program and display the inscription ON or OFF instead. I tried to do it somehow like this, but it didn't work for me.
OFF is always displayed. How to correctly compare the strings? Maybe I'm doing something else wrong?