【问题标题】:ESP32 was connecting earlier but is not connecting to WiFi now with the same codeESP32 之前连接过,但现在没有使用相同的代码连接到 WiFi
【发布时间】:2022-01-07 19:51:10
【问题描述】:

我正在做一个项目,我必须连接到 WiFi 网络。所以,我用这段代码让 ESP32 连接到 WiFi 网络 -

#include <Arduino.h>
#include <WiFi.h>

void setup() {
  Serial.begin(115200);
  WiFi.begin("XYZXYZ", "asdfghjkl");

  // Wait for WiFi to be connected
  uint32_t notConnectedCounter = 0;
  while (WiFi.status() != WL_CONNECTED) {
      delay(100);
      Serial.println("Wifi connecting...");
      notConnectedCounter++;
      if(notConnectedCounter > 50) { // Reset board if not connected after 5s
          Serial.println("Resetting due to Wifi not connecting...");
          ESP.restart();
      }
  }
  Serial.print("Wifi connected, IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
  // put your main code here, to run repeatedly:
}

我上面提到的代码运行良好,但由于某种原因,它现在无法运行。现在,当我为ESP32 供电时,它会发出类似(或类似)的东西-

}⸮~⸮}⸮n~⸮~ֶ⸮}⸮⸮⸮n⸮~n⸮⸮]⸮⸮⸮⸮⸮⸮D⸮b⸮⸮z⸮}⸮⸮⸮1]⸮⸮}⸮⸮~⸮⸮|⸮⸮~}⸮]⸮}⸮=~]⸮⸮]⸮⸮]⸮]⸮⸮n⸮⸮ ֎UvHX⸮.,⸮⸮a⸮⸮⸮]⸮⸮&gt;]⸮&gt;⸮]⸮]⸮n&gt;⸮⸮⸮&gt;&gt;⸮]⸮⸮&gt;]⸮]⸮⸮6⸮

我能做些什么来解决这个问题?

【问题讨论】:

    标签: arduino esp32 arduino-esp32


    【解决方案1】:

    确保您的Serial.begin(11520) 速度参数Serial Monitor 速度参数的值相同。

    【讨论】:

      猜你喜欢
      • 2020-10-18
      • 1970-01-01
      • 1970-01-01
      • 2022-06-13
      • 2023-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多