1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-20 21:01:25 +03:00

Changed examples to include shield detection

This commit is contained in:
Tom Igoe
2012-05-31 12:16:14 -04:00
parent 6e60b13013
commit b2a8a47c58
11 changed files with 157 additions and 92 deletions

View File

@ -7,7 +7,8 @@
Circuit:
* Wifi shield attached to pins 10, 11, 12, 13
created 23 Apr 2012
created 23 April 2012
modifide 31 May 2012
by Tom Igoe
http://arduino.cc/en/Tutorial/WifiWebClientRepeating
@ -38,15 +39,20 @@ void setup() {
// start serial port:
Serial.begin(9600);
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while(true);
}
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while(true);
}
// wait 10 seconds for connection:
delay(10000);
}