Good Morning Everybody, i not understand wy my board non connect to WiFi
i was check some topick and tutorial but same result ...
I try to change a setup of my router without success.
i was undestud wify is connectind and after return error, i was check a value of WiFi.status() and i have read value 6 = when disconnected from a network.
i dont understud was is wrong
This is my Code
#include <WiFi.h>
// Replace with your network credentials (STATION)
const char* ssid = "Miami-Dave";
const char* password = "xxxxxxxxxx";
void initWiFi() {
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi state ");
Serial.println(WiFi.status());
while (WiFi.status() != WL_CONNECTED) {
Serial.print('.');
delay(1000);
}
Serial.println(WiFi.localIP());
}
void setup() { Serial.begin(115200);
initWiFi();
Serial.print("RRSI: ");
Serial.println(WiFi.RSSI());
}
void loop() {
// put your main code here, to run repeatedly:
}
if i use WiFiScan project example i get right data:
5 networks found
Nr | SSID | RSSI | CH | Encryption
1 | Miami-Dave | -36 | 4 | WPA2
2 | TIM-52399316 | -88 | 2 | WPA2
3 | TP-Link_6C16 | -88 | 10 | WPA+WPA2
4 | TP-Link_FA98 | -92 | 11 | WPA+WPA2
5 | NETGEAR_EXT | -94 | 11 | open
Are you using an Arduino ESP32 or another ESP32-S3 board?
Please edit your post, select all code and click the <CODE/> button; next save your post.
This will apply code tags which make the code easier to read and copy and the forum software will display it correctly.
is not really needed, you can skip this. Check SSID and password if they are correct it should work.
The moment WiFi.status() == WL_CONNECTED your ESP32 hasn't got the IP yet. You should wait for a while or test when WiFi.localIP ().toString () is different than "0.0.0.0".
Hm, having 255.255.0.0 for the subnet mask for the home network is rather strange. Normally it would be 255.255.255.0 and this would also be a valid subnet mask for your address range (192.168.74.X).
If you are using DHCP the following should do.
WiFi.begin (STA_SSID, STA_PASSWORD);
while (WiFi.localIP ().toString () == "0.0.0.0") { // wait until we get IP from router's DHCP
delay (1000);
Serial.printf (" .\n");
}
Serial.printf ("Got IP: %s\n", (char *) WiFi.localIP ().toString ().c_str ());
If this is not working there must be something wrong with your ESP32 or your router settings.