WiFi的连接
const char *ssid = "WiFi名称";
const char *password = "WiFi密码";
// 设置模式
WiFi.mode(WIFI_STA);
// 开始连接
WiFi.begin(ssid, password);
// 检查连接,重试
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("Connected to WiFi network with IP Address: ");
Serial.println(WiFi.localIP());
重连
if (WiFi.status() != WL_CONNECTED)
{
WiFi.disconnect();
WiFi.begin(ssid, password);
}
标签:WiFi,ssid,WL,char,使用,Serial,password
From: https://www.cnblogs.com/okbuok/p/17034593.html