Gets the WiFi channel of a network that was scanned.
WiFi.channel(wifiAccessPoint)
…
// scan for nearby networks:
Serial.println("** Scan Networks **");
int numSsid = WiFi.scanNetworks();
if (numSsid == -1)
{
Serial.println("Couldn't get a WiFi connection");
while (true);
}
// print the list of networks seen:
Serial.print("number of available networks: ");
Serial.println(numSsid);
// print the network number and name for each network found:
for (int thisNet = 0; thisNet < numSsid; thisNet++) {
Serial.print(thisNet + 1);
Serial.print(") ");
Serial.print("Signal: ");
Serial.print(WiFi.RSSI(thisNet));
Serial.print(" dBm");
Serial.print("\tChannel: ");
Serial.print(WiFi.channel(thisNet));
byte bssid[6];
Serial.print("\t\tBSSID: ");
printMacAddress(WiFi.BSSID(thisNet, bssid));
Serial.print("\tEncryption: ");
printEncryptionType(WiFi.encryptionType(thisNet));
Serial.print("\t\tSSID: ");
Serial.println(WiFi.SSID(thisNet));
Serial.flush();
}
Serial.println();
…