AT command responses (understanding order of code execution on Arduino)

后端 未结 2 788
别跟我提以往
别跟我提以往 2020-12-11 12:05

I\'m sending AT commands to an ESP8266 from an Arduino Uno/Nano (ATmega328) and attempting to parse the end of the strings received in response to establish how the ESP reac

2条回答
  •  有刺的猬
    2020-12-11 12:13

    Your if after the while is indeed wrong because you might have read more stuff back and thus you don't end with the target string even though "ok" was received.

    You should just test if responseBuffer ends with target and return true only when you receive a new character in the while loop and not after. After you have a timeout, just return false.

提交回复
热议问题