Skip to content

Commit 5e9c956

Browse files
author
Tom Igoe
committed
Added Serial open check for Leonardo to ScanNetworks example
1 parent 28da3b1 commit 5e9c956

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

WiFi/examples/ScanNetworks/ScanNetworks.ino

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
created 13 July 2010
1212
by dlf (Metodo2 srl)
13-
modified 12 Mar 2012
13+
modified 2 April 2012
1414
by Tom Igoe
1515
*/
1616

@@ -19,8 +19,9 @@
1919
#include <WiFi.h>
2020

2121
void setup() {
22-
// initialize serial:
22+
// initialize serial and wait for the port to open:
2323
Serial.begin(9600);
24+
while(!Serial) ;
2425

2526
// attempt to connect using WEP encryption:
2627
Serial.println("Initializing Wifi...");
@@ -41,7 +42,7 @@ void loop() {
4142
void printMacAddress() {
4243
// the MAC address of your Wifi shield
4344
byte mac[6];
44-
45+
4546
// print your MAC address:
4647
WiFi.macAddress(mac);
4748
Serial.print("MAC: ");
@@ -66,7 +67,7 @@ void listNetworks() {
6667
// print the list of networks seen:
6768
Serial.print("number of available networks:");
6869
Serial.println(numSsid);
69-
70+
7071
// print the network number and name for each network found:
7172
for (int thisNet = 0; thisNet<numSsid; thisNet++) {
7273
Serial.print(thisNet);
@@ -81,3 +82,4 @@ void listNetworks() {
8182
}
8283

8384

85+

0 commit comments

Comments
 (0)