ESP32 scan class help needed

I am trying to use scan class for ESP32. My goal is to scan for specific ssid only. Following is the relevant code I am using:

#include <WiFi.h>
#include <esp_wifi.h>

const char* ssid = "ESP";
int apChannel = 7;

void setup() {
  
  //int16_t scanNetworks(bool async = false, bool show_hidden = false, bool passive = false, uint32_t max_ms_per_chan = 300, uint8_t channel = 0, const char * ssid=nullptr, const uint8_t * bssid=nullptr);
  int n = WiFi.scanNetworks(true, false, false, 300, apChannel, ssid);
  
}

void loop() { }

I get error message in arduino IDE:
no matching function for call to 'WiFiClass::scanNetworks(bool, bool, bool, int, int&, const char*&)'

I need help please.

Thanks.

It looks like yet another library is needed. Check what WiFi.h needs!

Isn't parameter 'apChannel' supposed to be a pointer?

@Railroader You were right I added the library needed. Thanks.
@anon57585045 I have no problem using apChannel as it is but error is generated only whe I pass ssid varible.

Thanks.

Great! Thanks for telling!
During the time as professional many large and sophisticated systems came in my way. Intuition, general thinking,... worked.
Nice being able to contribute here.

@Railroader My problem is still not solved. Do you have any suggestions?

Thanks.

Shit. I thought it pulled the plug.

What does the current block look like?

take a look at WiFiScan.h

@horace That's where I got the below line:

//int16_t scanNetworks(bool async = false, bool show_hidden = false, bool passive = false, uint32_t max_ms_per_chan = 300, uint8_t channel = 0, const char * ssid=nullptr, const uint8_t * bssid=nullptr);

How do I get rid of error mentioned in first post.

Thanks.

looking at the version of WiFiScan.h installed on my PC its declaration is

   int16_t scanNetworks(bool async = false, bool show_hidden = false, bool passive = false, uint32_t max_ms_per_chan = 300, uint8_t channel = 0);

5 parameters - clearly there are different libraries around

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.