如何修复无法从 esp8266 响应中读取 serial.find("OK")

How to fix cannot read serial.find("OK") from esp8266 response

我尝试使用 AT+CWJAP 将我的 ESP8266 连接到 wifi 路由器,但我有一个问题无法读取 esp8266 对我的 arduino 的响应。

当我尝试从 arduino 代码发送 AT 到 esp 时,它无法读取 OK 来自 esp8266 的响应 Serial.find("OK") 不工作。我把波特率改成115200也没用

这是串行捕获:

> 14:04:45.882 -> AT 
> 14:04:51.868 -> NOT OK! 
> 14:04:51.901 -> AT+CIPSTART="TCP","184.106.153.149",80 
> 14:04:54.899 -> AT+CIPSEND=55
> 14:04:55.873 -> AT+CIPCLOSE

这是arduino代码:

void setup()
    {
      Serial.begin(9600); //or use default 115200.
      Serial.println("AT");
      delay(5000);
      if(Serial.find("OK")){
        connectWiFi();
      }
      else{
        Serial.println("NOT OK!");
      }
    }

它应该 运行 ConnectWiFi() 功能但输出是 "NOT OK!"

您的波特率为incorrect。应该是 115200.