1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Added Serial open check for Leonardo to ScanNetworks example

This commit is contained in:
Tom Igoe 2012-04-02 09:45:39 -04:00
parent 28da3b1d38
commit 5e9c956338

View File

@ -10,7 +10,7 @@
created 13 July 2010
by dlf (Metodo2 srl)
modified 12 Mar 2012
modified 2 April 2012
by Tom Igoe
*/
@ -19,8 +19,9 @@
#include <WiFi.h>
void setup() {
// initialize serial:
// initialize serial and wait for the port to open:
Serial.begin(9600);
while(!Serial) ;
// attempt to connect using WEP encryption:
Serial.println("Initializing Wifi...");
@ -41,7 +42,7 @@ void loop() {
void printMacAddress() {
// the MAC address of your Wifi shield
byte mac[6];
// print your MAC address:
WiFi.macAddress(mac);
Serial.print("MAC: ");
@ -66,7 +67,7 @@ void listNetworks() {
// 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);
@ -81,3 +82,4 @@ void listNetworks() {
}