Merge branch 'hd_2.7' of github.com:arduino/wifishield into hd_2.7

This commit is contained in:
Mimmo La Fauci 2012-06-05 15:09:19 +02:00
commit 3ad4f98b22
13 changed files with 160 additions and 94 deletions

View File

@ -9,8 +9,8 @@
created 13 July 2010
by dlf (Metodo2 srl)
modified 29 Feb 2012
by Scott Fitzgerald
modified 31 May 2012
by Tom Igoe
*/
#include <WiFi.h>
@ -20,23 +20,28 @@ int status = WL_IDLE_STATUS; // the Wifi radio's status
void setup() {
// initialize serial:
Serial.begin(9600);
// attempt to connect to an open network:
Serial.print("Attempting to connect to open network: ");
Serial.println(ssid);
status = WiFi.begin(ssid);
// if you're not connected, stop here:
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while(true);
}
// if you are connected :
else {
Serial.print("You're connected to the network");
printCurrentNet();
printWifiData();
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to open SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid);
// wait 10 seconds for connection:
delay(10000);
}
// you're connected now, so print out the data:
Serial.print("You're connected to the network");
printCurrentNet();
printWifiData();
}
void loop() {

View File

@ -19,7 +19,7 @@
created 13 July 2010
by dlf (Metodo2 srl)
modified 4 Mar 2012
modified 31 May 2012
by Tom Igoe
*/
#include <WiFi.h>
@ -33,22 +33,27 @@ void setup() {
// initialize serial:
Serial.begin(9600);
// attempt to connect to an open network:
Serial.print("Attempting to connect to WEP network: ");
Serial.println(ssid);
status = WiFi.begin(ssid, keyIndex, key);
// if you're not connected, stop here:
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while(true);
}
// if you are connected :
else {
Serial.print("You're connected to the network");
printCurrentNet();
printWifiData();
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WEP network, SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, keyIndex, key);
// wait 10 seconds for connection:
delay(10000);
}
// once you are connected :
Serial.print("You're connected to the network");
printCurrentNet();
printWifiData();
}
void loop() {
@ -60,7 +65,7 @@ void loop() {
void printWifiData() {
// print your WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.print("IP Address: ");
Serial.println(ip);
Serial.println(ip);
@ -115,3 +120,4 @@ void printCurrentNet() {
}

View File

@ -9,35 +9,42 @@
created 13 July 2010
by dlf (Metodo2 srl)
modified 29 Feb 2012
by Scott Fitzgerald
modified 31 May 2012
by Tom Igoe
*/
#include <WiFi.h>
char ssid[] = "networkName"; // your network SSID (name)
char pass[] = "yourPassword"; // your network password
char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "secretPassword"; // your network password
int status = WL_IDLE_STATUS; // the Wifi radio's status
void setup() {
// initialize serial:
Serial.begin(9600);
// attempt to connect to an open network:
Serial.print("Attempting to connect to WPA network: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
// if you're not connected, stop here:
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while(true);
}
// if you are connected :
else {
Serial.print("You're connected to the network");
printCurrentNet();
printWifiData();
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
// you're connected now, so print out the data:
Serial.print("You're connected to the network");
printCurrentNet();
printWifiData();
}
void loop() {

View File

@ -10,7 +10,7 @@
created 13 July 2010
by dlf (Metodo2 srl)
modified 22 April 2012
modified 31 May 2012
by Tom Igoe
*/
@ -21,9 +21,15 @@
void setup() {
// initialize serial and wait for the port to open:
Serial.begin(9600);
// attempt to connect using WEP encryption:
Serial.println("Initializing Wifi...");
// check for the presence of the shield:
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue:
while(true);
}
// Print WiFi MAC address:
printMacAddress();
// scan for existing networks:

View File

@ -14,7 +14,7 @@
created 18 Dec 2009
by David A. Mellis
modified 23 Apr 2012
modified 31 May 2012
by Tom Igoe
*/
@ -22,8 +22,8 @@
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "YourNetwork"; // your network SSID (name)
char pass[] = "password"; // your network password (use for WPA, or use as key for WEP)
char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "secretPassword"; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP)
@ -36,16 +36,21 @@ boolean alreadyConnected = false; // whether or not the client was connected pre
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);
}

View File

@ -16,7 +16,7 @@
* Wifi shield attached to pins 10, 11, 12, 13
created 13 Mar 2012
modified 14 May 2012
modified 31 May 2012
by Tom Igoe
This code is in the public domain.
@ -49,15 +49,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);
}

View File

@ -19,7 +19,7 @@
* Wifi shield attached to pins 10, 11, 12, 13
created 16 Mar 2012
modified 14 May 2012
modified 31 May 2012
by Tom Igoe
This code is in the public domain.
@ -53,16 +53,21 @@ const unsigned long postingInterval = 10*1000; //delay between updates to cosm.
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);
}

View File

@ -14,6 +14,7 @@
* WiFi shield attached to pins 10, 11, 12, 13
created 23 apr 2012
modified 31 May 2012
by Tom Igoe
This code is in the public domain.
@ -22,7 +23,7 @@
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "YourNetwork"; // your network SSID (name)
char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "password"; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP)
@ -51,16 +52,21 @@ void setup() {
tweet.reserve(150);
// 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);
status = WiFi.begin(ssid, pass);
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
while(true);
}
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}

View File

@ -16,7 +16,7 @@
created 13 July 2010
by dlf (Metodo2 srl)
modified 23 Apr 2012
modified 31 May 2012
by Tom Igoe
*/
@ -24,8 +24,8 @@
#include <SPI.h>
#include <WiFi.h>
char ssid[] = "YourNetwork"; // your network SSID (name)
char pass[] = "password"; // your network password (use for WPA, or use as key for WEP)
char ssid[] = "yourNetwork"; // your network SSID (name)
char pass[] = "secretPassword"; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP)
int status = WL_IDLE_STATUS;
@ -41,16 +41,21 @@ WiFiClient client;
void setup() {
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);
}

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);
}

View File

@ -13,7 +13,7 @@
created 13 July 2010
by dlf (Metodo2 srl)
modified 23 Apr 2012
modified 31 May 2012
by Tom Igoe
*/
#include <SPI.h>
@ -32,11 +32,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);
// wait 10 seconds for connection:
delay(10000);
}

View File

@ -163,7 +163,7 @@ uint8_t WiFiDrv::getConnectionStatus()
SpiDrv::waitForSlaveReady();
// Wait for reply
uint8_t _data = 0;
uint8_t _data = -1;
uint8_t _dataLen = 0;
SpiDrv::waitResponseCmd(GET_CONN_STATUS_CMD, PARAM_NUMS_1, &_data, &_dataLen);

View File

@ -26,7 +26,8 @@
#define WL_MAX_ATTEMPT_CONNECTION 10
typedef enum {
WL_IDLE_STATUS,
WL_NO_SHIELD = 255,
WL_IDLE_STATUS = 0,
WL_NO_SSID_AVAIL,
WL_SCAN_COMPLETED,
WL_CONNECTED,