Skip to content

WiFi.scanComplete() always return -2 on ESP32 #3302

@Rezaasghariir

Description

@Rezaasghariir

In esp32-wroom-32 when i want scan WiFi station WiFi.scanComplete() always return -2
my code is :
/*

  • This sketch demonstrates how to scan WiFi networks.
  • The API is almost the same as with the WiFi Shield library,
  • the most obvious difference being the different file you need to include:
    */
    #include "WiFi.h"

void setup()
{
Serial.begin(115200);

// 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.scanComplete();
Serial.println("scan done");
if (n == 0) {
    Serial.println("no networks found");
} else {
    Serial.print(n);
}
Serial.println("");

// Wait a bit before scanning again
delay(5000);

}
I thinks its a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions