Connect to WiFi gives code 6
Posted: Mon Dec 21, 2020 11:15 am
I want to connect my esp8266 (Wemos D1 mini) to the wifi coming from my router. But when doing this it gives code 6. According to documentation, this is WL_CONNECT_WRONG_PASSWORD. I changed the password in the router 3 times to simple password to make sure the password is correct and it still gives this code.
When I try to connect to a mobile phone hotspot, it gives code 6 one time and then it connects. Does anybody know why I cannot connect to my router while the password is correct? The router is using 2.4 GHz, 802.11 b/g/n
Code:
When I try to connect to a mobile phone hotspot, it gives code 6 one time and then it connects. Does anybody know why I cannot connect to my router while the password is correct? The router is using 2.4 GHz, 802.11 b/g/n
Code:
Code: Select all
const char* ssid = "SSIDHERE";
const char* password = "Pass HERE";
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
WiFi.disconnect();
// We start by connecting to a WiFi network
Serial.println("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(3500);
Serial.print(".");
Serial.printf("Connection status: %d\n", WiFi.status());
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}