No WIFI connection with my ESP8266.

Hi all, I don't understand why, but my ESP8266 no longer wants to connect to the WIFI. The name of my network and my password have been verified. I tried with another shared network from my phone. I did a reset of the ESP8266 with nodemcu-flasher-master. Here's my simplest code
C++
#include "ESP8266WiFi.h"

const char* ssid = "xxxx";
const char* password = "xxxxx";

void setup() {

// initialize serial and wait for the port to open:
Serial.begin(115200);
Serial.println("connecting to ");
Serial.println(ssid);

// attempt to connect using WEP encryption:
WiFi.persistent(false); // solution found on a forum but does not work
WiFi.setAutoReconnect(true); // solution found on a forum but does not work

WiFi.mode(WIFI_OFF); // solution found on a forum but does not work
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
///network search
Serial.println("network search ");
int n = WiFi.scanNetworks();

Serial.println("start done ...");
if (n == 0) {
Serial.println("no network found ...");
} else {
Serial.print(n);
Serial.println("network found");

for (int i = 0; i < n; i++) {
Serial.print(i + 1);
Serial.println(":");
Serial.print(WiFi.SSID(i));
Serial.println(" (");
Serial.print(WiFi.RSSI(i));
Serial.println(")");
if (WiFi.encryptionType(i) == ENC_TYPE_NONE) {
Serial.println(" ");
} else {
Serial.println("*");
}
}
}
/// end of network search
}
Serial.println("");
Serial.println("WIFI connected ");
Serial.println("Local IP address: ");
Serial.println(WiFi.localIP());
}

void loop() {
}
C++
#include "ESP8266WiFi.h"

const char* ssid = "xxxx";
const char* password = "xxxxx";

void setup() {

// initialize serial and wait for the port to open:
Serial.begin(115200);
Serial.println("connecting to ");
Serial.println(ssid);

// attempt to connect using WEP encryption:
WiFi.persistent(false); // solution found on a forum but does not work
WiFi.setAutoReconnect(true); // solution found on a forum but does not work

WiFi.mode(WIFI_OFF); // solution found on a forum but does not work
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
///network search
Serial.println("network search ");
int n = WiFi.scanNetworks();

Serial.println("start done ...");
if (n == 0) {
Serial.println("no network found ...");
} else {
Serial.print(n);
Serial.println("network found");

for (int i = 0; i < n; i++) {
Serial.print(i + 1);
Serial.println(":");
Serial.print(WiFi.SSID(i));
Serial.println(" (");
Serial.print(WiFi.RSSI(i));
Serial.println(")");
if (WiFi.encryptionType(i) == ENC_TYPE_NONE) {
Serial.println(" ");
} else {
Serial.println("*");
}
}
}
/// end of network search
}
Serial.println("");
Serial.println("WIFI connected ");
Serial.println("Local IP address: ");
Serial.println(WiFi.localIP());
}

void loop() {
}
I remain in the While loop, I see my network... but nothing more. Do you have any ideas?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server