Post topics, source code that relate to the Arduino Platform

User avatar
By Blue Birds Fly
#89887 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());
}
User avatar
By Blue Birds Fly
#89904 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. ?