1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-19 09:42:11 +03:00

Updated ScanNetworks to include RSSI and Encryption type for each network

This commit is contained in:
Tom Igoe
2012-03-04 16:59:16 -05:00
parent 0ddbfd0e95
commit 45ab1504ac

View File

@ -10,7 +10,7 @@
created 13 July 2010 created 13 July 2010
by dlf (Metodo2 srl) by dlf (Metodo2 srl)
modified 1 Mar 2012 modified 4 Mar 2012
by Tom Igoe by Tom Igoe
*/ */
@ -24,10 +24,9 @@ void setup() {
// attempt to connect using WEP encryption: // attempt to connect using WEP encryption:
Serial.println("Initializing Wifi..."); Serial.println("Initializing Wifi...");
WiFi.begin("networName"); //WiFi.begin("no network");
printMacAddress(); printMacAddress();
// scan for existing networks: // scan for existing networks:
Serial.println("Scanning available networks..."); Serial.println("Scanning available networks...");
scanNetworks(); scanNetworks();
@ -68,11 +67,16 @@ void scanNetworks() {
// print the list of networks seen: // print the list of networks seen:
Serial.print("SSID List:"); Serial.print("SSID List:");
Serial.println(numSsid); Serial.println(numSsid);
Serial.println("#\tNetwork:\tRSSI:\tEncryption:");
// print the network number and name for each network found: // print the network number and name for each network found:
for (int thisNet = 0; thisNet<numSsid; thisNet++) { for (int thisNet = 0; thisNet<numSsid; thisNet++) {
Serial.print(thisNet); Serial.print(thisNet);
Serial.print(") Network: "); Serial.print(")\t");
Serial.println(WiFi.SSID(thisNet)); Serial.print(WiFi.SSID(thisNet));
Serial.print("\t");
Serial.print(WiFi.RSSI(thisNet));
Serial.print("\t");
Serial.println(WiFi.encryptionType(thisNet));
} }
} }