Wemos D1 mini won't connect to WiFi: status code 6 So I have a Wemos D1 mini which I want to connect to my WiFI in order to let is push sensor data to my server. But I cannot connect it with my WiFi as I get a code 6.
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print(&quot;Connecting to &quot;);
Serial.println(ssid);
    
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
  delay(500);
  Serial.print(&quot;.&quot;);
  Serial.print(WiFi.status());
}
    
Serial.println(&quot;&quot;);
Serial.println(&quot;WiFi connected&quot;);
Serial.println(&quot;IP address: &quot;);
Serial.println(WiFi.localIP());

The Serial.print(WiFi.status()); prints 6 which is WL_CONNECT_FAILED if I'm right.
I checked the router and it uses WPA/WPA2, the ssid and password are correct. The router is using 2.4 GHz with WiFi 802.11b and 802.11g.
I used the board to scan, with the example code provided by the esp8266 board manager library thing, and it found my SSID with the ones of my neighbors.
Can somebody tell me what is going wrong?
I already checked solutions like: This one , github answers, etc.
Edit: It can connect to a mobile phone hotspot. It gives code 6 1 time and then it connects. Any one an idea how I connect to the WiFi the router is providing ?
Apparently, something went wrong with connecting to the router. The router was casting 802.11 g + n, which for some reason, made the esp8266 give a code 6. I have tried 802.11 b, 802.11 b+g+n, 802.11 n, which work all fine.
So I updated the settings that the router now uses 802.11n and the esp8266 can now connect to the internet!