-->
Page 1 of 2

Connect to WiFi gives code 6

PostPosted: Mon Dec 21, 2020 11:15 am
by Blue Birds Fly
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:
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());
}

Re: Connect to WiFi gives code 6

PostPosted: Tue Dec 22, 2020 3:13 am
by JurajA
do you use the GitHub master version of esp8266 Arduino?
WL_CONNECT_WRONG_PASSWORD is new
it is not in any published version

Re: Connect to WiFi gives code 6

PostPosted: Tue Dec 22, 2020 5:45 am
by Blue Birds Fly
Yes, I used the GitHub version and I found the code in the docs
https://arduino-esp8266.readthedocs.io/en/latest/esp8266wifi/readme.html#diagnostics

Do you know what I have to do to fix this error? Are there router settings wrong? Do I use wrong code, my d1 doesn't work, etc. ?

Re: Connect to WiFi gives code 6

PostPosted: Wed Dec 23, 2020 2:26 am
by JurajA
if it reports WL_CONNECT_WRONG_PASSWORD then the password is wrong