When using WiFi.h
. I am unable to use its scanNetworks
function like this - WiFi.ScanNetworks();
I am using the unPhone 9 building through platformio. Everything else works, its just when I try to scan the network. I have also attached the serial monitor output: ESP-ROM:esp32s3-20210327Build:Mar 27 2021rst:0xc (RTC_SW_CPU_RST),boot:0x2b - Pastebin.com
I have tried two methods:
// WiFi Page
void wifiPage()
{
int n = WiFi.scanNetworks();
...
}
and also this, where it was non-blocking.
void scanNetworks()
{
Serial.println("Scanning for WiFi networks...");
WiFi.scanNetworks(true);
unsigned long scanStar = millis();
int scanResult = WIFI_SCAN_RUNNING;
while (scanResult == WIFI_SCAN_RUNNING)
{
scanResult = WiFi.scanComplete();
delay(100);
yield();
if (millis() - scanStar > 10000)
{
Serial.println("Scan timed out");
WiFi.scanDelete();
return;
}
}
...