Page 1 of 1

Reading serialBT string and compare it to another string

Posted: Mon Jan 25, 2021 7:48 pm
by effita
hello I'm trying to read serial BT string, the basic code is:

While (SerialBT.availible()) {
Character = SerialBT.read();
tmp_bt.concat(Character);
}
If (tmp_bt.equals(string)) {
//Do that
}

string is predetermined text, if returns false, any advice what could go wrong?

Re: Reading serialBT string and compare it to another string

Posted: Mon Jan 25, 2021 8:50 pm
by ORSO2001
is the "tmp_bt" reset somewhere?
are you sure that the incoming characters has no '\r' and-or '\n'?
are you sure that the "tmp_bt" and the singles chars in the end String has the same case?
did you try to print the incomings chars?