乐鑫技术交流
直播中

一刀两断

8年用户 948经验值
私信 关注
[问答]

Arduino IDE1.8.5串行监视器和WIFI问题求解

我不确定哪个论坛是正确的,所以我决定将其发布在“一般讨论”中。
我使用 Arduino IDE 1.8.5 已经有一段时间了。
两年来,我一直在使用 ESP8266 (NodeMCU) 来控制我的智能家居的各个部分。昨天有一个百叶窗没有放下,我发现 ESP8266 没有设置输出到继电器。所以我决定换一个新的。但是:当我将(旧)草图下载到 NodeMCU 时,我既无法连接到 WIFI,也无法从串行监视器中获得任何有用信息。串行连接 (Serial.begin) 设置为 115200,监视器也是如此。我可以使用我喜欢的任何波特率,我只会得到垃圾。除此之外,WIFI 不连接。
最后我用了一个非常简单的草图来检查连接:
代码:全选#include         // Include the Wi-Fi library

const char* ssid     = "******";         // The SSID (name) of the Wi-Fi network you want to connect to
const char* password = "******";     // The password of the Wi-Fi network

void setup() {
  Serial.begin(115200);         // Start the Serial communication to send messages to the computer
  delay(10);
  Serial.println('n');
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);             // Connect to the network
  Serial.print("Connecting to ");
  Serial.print(ssid);

  while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    delay(500);
    Serial.print('.');
  }

  Serial.println('n');
  Serial.println("Connection established!");  
  Serial.print("IP address:t");
  Serial.println(WiFi.localIP());         // Send the IP address of the ESP8266 to the computer
}

void loop() {
  
}
这确实告诉我连接被拒绝了。这确实发生在两个不同的接入点(路由器和 Raspberry)上。
知道出了什么问题吗?
                     

更多回帖

发帖
×
20
完善资料,
赚取积分