Reference Language | Libraries | Comparison | Changes
WiFi
WiFi.scanNetworks()
Description
Scans for available WiFi networks and returns the discovered number
Syntax
WiFi.scanNetworks();
Parameters
none
Returns
byte : number of discovered networks
Example
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "yourNetwork"; // the name of your network
void setup() {
Serial.begin(9600);
int status = WiFi.begin(ssid);
if (status != WL_CONNECTED) {
Serial.println("Couldn't get a WiFi connection");
while (true);
}
else {
// if you are connected, scan for available WiFi networks and print the number discovered:
Serial.println("** Scan Networks **");
byte numSsid = WiFi.scanNetworks();
Serial.print("Number of available WiFi networks discovered:");
Serial.println(numSsid);
}
}
void loop() {}
Reference Home
Corrections, suggestions, and new documentation should be posted to the Forum.
The text of the Arduino reference is licensed under a
Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.