Code: Select all
#include "WiFi.h"
void setup() {
Serial.begin(115200);
// WiFi.mode(WIFI_AP_STA);
WiFi.mode(WIFI_STA);
Serial.println("\n\n\nTansys_>");
Serial.println("WiFi.getAutoConnect() => "+String( WiFi.getAutoConnect() ));
Serial.printf("SSID:%s\r\n", WiFi.SSID().c_str()); //
Serial.printf("PSW:%s\r\n", WiFi.psk().c_str()); //
WiFi.begin( WiFi.SSID().c_str(), WiFi.psk().c_str() );
long tm = millis();
while( WiFi.status() != WL_CONNECTED && millis()-tm < 1000*8 ) {
delay(500);
Serial.print(".");
}
if( WiFi.status() == WL_CONNECTED ){
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
}else{
WiFi.beginSmartConfig();
Serial.println("Waiting for SmartConfig.");
while (!WiFi.smartConfigDone()) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("SmartConfig received.");
Serial.println("Waiting for WiFi");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi Connected.");
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
}
}
void loop() {
}
1.SSID returns empty,I have modified the“ WiFiSTA.cpp”。
2.Chinese character SSID garbled,Cannot connect network!