Reading serialBT string and compare it to another string

effita
Posts: 2
Joined: Tue Jan 19, 2021 7:56 pm

Reading serialBT string and compare it to another string

Postby effita » Mon Jan 25, 2021 7:48 pm

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?

ORSO2001
Posts: 5
Joined: Fri Jan 03, 2020 2:48 pm

Re: Reading serialBT string and compare it to another string

Postby ORSO2001 » Mon Jan 25, 2021 8:50 pm

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?

Who is online

Users browsing this forum: No registered users and 86 guests