1

I need to check if a given SSID is in range. Would be good if it didn't disconnect from the current wifi network that it's connected to, but it doesnt matter, i just need to see if a SSID is in range, whether it does disconnect or not. It should be something like this:

if(WiFi.SSID(checkforthisSSID)) {
 //do something
}

Thanks.

asked Jul 26, 2017 at 13:29

2 Answers 2

4

Not so tough it is possible just try the bellow code :)

void loop() {
 Serial.println("scan start");
 // WiFi.scanNetworks will return the number of networks found
 CheckPossibility();
 }
 CheckPossibility(){
 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
 if(WiFi.SSID(i) == "REPLACE THIS WITH YOUR SSID"){ //enter the ssid which you want to search
 Serial.println("The network you are looking for is available");
 }
 }
 }
 Serial.println("");
 // Wait a bit before scanning again
 // delay(5000);
}
answered Jul 27, 2017 at 2:39
-1

Try to connect to an AP, Use scan networks example, then look if the SSID in in the response. Did not try, the scan networks example has an "WiFi.disconnect()" before the scan() function.

answered Jul 26, 2017 at 13:34

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.