Hello all,
I'm running into an issue currently when I try to connect using the WiFi capabilities of my NodeMCU.
When I try to scan for networks, I find that no networks were found, despite the presence of several networks. Also, when I attempt a direct connection to my network by using an SSID and password, it is unable to connect.
Here is the sketch I am using to scan (it's the example sketch for WifiScan):
#include "ESP8266WiFi.h"
void setup() {
Serial.begin(74880);
// Set WiFi to station mode and disconnect from an AP if it was previously connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
Serial.println("Setup done");
}
void loop() {
Serial.println("scan start");
// WiFi.scanNetworks will return the number of networks found
int n = WiFi.scanNetworks();
Serial.println("scan done");
if (n == 0)
Serial.println("no networks found");
else
{
Serial.print(n);
Serial.println(" networks found");
for (int i = 0; i < n; ++i)
{
// Print SSID and RSSI for each network found
Serial.print(i + 1);
Serial.print(": ");
Serial.print(WiFi.SSID(i));
Serial.print(" (");
Serial.print(WiFi.RSSI(i));
Serial.print(")");
Serial.println((WiFi.encryptionType(i) == ENC_TYPE_NONE)?" ":"*");
delay(10);
}
}
Serial.println("");
// Wait a bit before scanning again
delay(5000);
}
This sketch outputs:
scan start
scan done
no networks found
over and over.
Here is the sketch I am using to attempt to directly connect:
#include "ESP8266WiFi.h"
// WiFi parameters to be configured
const char* ssid = "SelenaNetwork";
const char* password = "grace888";
void setup(void)
{
Serial.begin(74880);
// Connect to WiFi
WiFi.begin(ssid, password);
// while wifi not connected yet, print '.'
// then after it connected, get out of the loop
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
//print a new line, then print WiFi connected and the IP address
Serial.println("");
Serial.println("WiFi connected");
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
// Nothing
}
This sketch simply outputs dots to serial output until I stop the board from running. I have verified that my router is broadcasting the SSID at 2.4 GHz and is requiring the correct password. Other devices can connect to it without issue.
Please note that I have 2 NodeMCU boards and both exhibit the same exact behavior.
Any help would be appreciated.
Thanks!