Skip to content

Commit 910111a

Browse files
committed
Added check in case of shield not present
1 parent a1fa79a commit 910111a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

WiFi/examples/ScanNetworks/ScanNetworks.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ void printMacAddress() {
6161
void listNetworks() {
6262
// scan for nearby networks:
6363
Serial.println("** Scan Networks **");
64-
byte numSsid = WiFi.scanNetworks();
64+
int numSsid = WiFi.scanNetworks();
65+
if (numSsid == -1)
66+
{
67+
Serial.println("Couldn't get a wifi connection");
68+
while(true);
69+
}
6570

6671
// print the list of networks seen:
6772
Serial.print("number of available networks:");

0 commit comments

Comments
 (0)