Skip to content
This repository was archived by the owner on Dec 20, 2018. It is now read-only.

Commit 7748c72

Browse files
committed
update for feather m0, make connecting faster
1 parent 362908b commit 7748c72

File tree

4 files changed

+81
-26
lines changed

4 files changed

+81
-26
lines changed

examples/CheckWifi101FirmwareVersion/CheckWifi101FirmwareVersion.ino

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/*
2-
* This example check if the firmware loaded on the Wifi101
3-
* shield is updated.
2+
* This example check if the firmware loaded on the ATWINC1500 is updated.
43
*
54
* Circuit:
6-
* - WiFi101 Shield attached
5+
* - Feather M0 WiFi (WINC1500), WiFi 101 shield, or WINC1500 Breakout
76
*
87
* Created 29 July 2015 by Cristian Maglie
98
* This code is in the public domain.
@@ -15,11 +14,19 @@
1514
#define WINC_CS 8
1615
#define WINC_IRQ 7
1716
#define WINC_RST 4
18-
#define WINC_EN 2 // or, tie EN to VCC
17+
#define WINC_EN 2 // or, tie EN to VCC and comment this out
1918

2019
Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);
2120

21+
// Default Hardware SPI (SCK/MOSI/MISO), SS -> #10, INT -> #7, RST -> #5, EN -> 3-5V
22+
//Adafruit_WINC1500 WiFi;
23+
2224
void setup() {
25+
#ifdef WINC_EN
26+
pinMode(WINC_EN, OUTPUT);
27+
digitalWrite(WINC_EN, HIGH);
28+
#endif
29+
2330
// Initialize serial
2431
Serial.begin(9600);
2532
while (!Serial) {
@@ -61,4 +68,4 @@ void setup() {
6168

6269
void loop() {
6370
// do nothing
64-
}
71+
}

examples/ConnectNoEncryption/ConnectNoEncryption.ino

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,36 @@
44
Then it prints the MAC address of the Wifi shield,
55
the IP address obtained, and other network details.
66
7-
Circuit:
8-
* WiFi shield attached
7+
* Circuit:
8+
* - Feather M0 WiFi (WINC1500), WiFi 101 shield, or WINC1500 Breakout
99
1010
created 13 July 2010
1111
by dlf (Metodo2 srl)
1212
modified 31 May 2012
1313
by Tom Igoe
1414
*/
1515
#include <SPI.h>
16-
#include <WiFi101.h>
16+
#include <Adafruit_WINC1500.h>
17+
18+
#define WINC_CS 8
19+
#define WINC_IRQ 7
20+
#define WINC_RST 4
21+
#define WINC_EN 2 // or, tie EN to VCC and comment this out
22+
23+
Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);
24+
25+
// Default Hardware SPI (SCK/MOSI/MISO), SS -> #10, INT -> #7, RST -> #5, EN -> 3-5V
26+
//Adafruit_WINC1500 WiFi;
1727

1828
char ssid[] = "yourNetwork"; // the name of your network
1929
int status = WL_IDLE_STATUS; // the Wifi radio's status
2030

2131
void setup() {
32+
#ifdef WINC_EN
33+
pinMode(WINC_EN, OUTPUT);
34+
digitalWrite(WINC_EN, HIGH);
35+
#endif
36+
2237
//Initialize serial and wait for port to open:
2338
Serial.begin(9600);
2439
while (!Serial) {
@@ -33,15 +48,19 @@ void setup() {
3348
}
3449

3550
// attempt to connect to Wifi network:
36-
while ( status != WL_CONNECTED) {
37-
Serial.print("Attempting to connect to open SSID: ");
51+
while (WiFi.status() != WL_CONNECTED) {
52+
Serial.print("Attempting to connect to SSID: ");
3853
Serial.println(ssid);
3954
status = WiFi.begin(ssid);
4055

4156
// wait 10 seconds for connection:
42-
delay(10000);
57+
uint8_t timeout = 10;
58+
while (timeout && (WiFi.status() != WL_CONNECTED)) {
59+
timeout--;
60+
delay(1000);
61+
}
4362
}
44-
63+
4564
// you're connected now, so print out the data:
4665
Serial.print("You're connected to the network");
4766
printCurrentNet();
@@ -119,4 +138,3 @@ void printCurrentNet() {
119138
Serial.print("Encryption Type:");
120139
Serial.println(encryption, HEX);
121140
}
122-

examples/ConnectWithWPA/ConnectWithWPA.ino

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,37 @@
44
Then it prints the MAC address of the Wifi shield,
55
the IP address obtained, and other network details.
66
7-
Circuit:
8-
* WiFi shield attached
7+
* Circuit:
8+
* - Feather M0 WiFi (WINC1500), WiFi 101 shield, or WINC1500 Breakout
99
1010
created 13 July 2010
1111
by dlf (Metodo2 srl)
1212
modified 31 May 2012
1313
by Tom Igoe
1414
*/
1515
#include <SPI.h>
16-
#include <WiFi101.h>
16+
#include <Adafruit_WINC1500.h>
17+
18+
#define WINC_CS 8
19+
#define WINC_IRQ 7
20+
#define WINC_RST 4
21+
#define WINC_EN 2 // or, tie EN to VCC and comment this out
22+
23+
Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);
24+
25+
// Default Hardware SPI (SCK/MOSI/MISO), SS -> #10, INT -> #7, RST -> #5, EN -> 3-5V
26+
//Adafruit_WINC1500 WiFi;
1727

1828
char ssid[] = "yourNetwork"; // your network SSID (name)
1929
char pass[] = "secretPassword"; // your network password
2030
int status = WL_IDLE_STATUS; // the Wifi radio's status
2131

2232
void setup() {
33+
#ifdef WINC_EN
34+
pinMode(WINC_EN, OUTPUT);
35+
digitalWrite(WINC_EN, HIGH);
36+
#endif
37+
2338
//Initialize serial and wait for port to open:
2439
Serial.begin(9600);
2540
while (!Serial) {
@@ -34,14 +49,18 @@ void setup() {
3449
}
3550

3651
// attempt to connect to Wifi network:
37-
while ( status != WL_CONNECTED) {
38-
Serial.print("Attempting to connect to WPA SSID: ");
52+
while (WiFi.status() != WL_CONNECTED) {
53+
Serial.print("Attempting to connect to SSID: ");
3954
Serial.println(ssid);
40-
// Connect to WPA/WPA2 network:
55+
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
4156
status = WiFi.begin(ssid, pass);
4257

4358
// wait 10 seconds for connection:
44-
delay(10000);
59+
uint8_t timeout = 10;
60+
while (timeout && (WiFi.status() != WL_CONNECTED)) {
61+
timeout--;
62+
delay(1000);
63+
}
4564
}
4665

4766
// you're connected now, so print out the data:

examples/WiFiWebClient/WiFiWebClient.ino

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
/*
22
Web client
33
4-
This sketch connects to a website (http://www.google.com)
5-
using a WiFi shield.
4+
This sketch connects to a website (http://www.adafruit.com)
5+
using a WINC1500
66
77
This example is written for a network using WPA encryption. For
88
WEP or WPA, change the Wifi.begin() call accordingly.
99
1010
This example is written for a network using WPA encryption. For
1111
WEP or WPA, change the Wifi.begin() call accordingly.
1212
13-
Circuit:
14-
* WiFi shield attached
13+
* Circuit:
14+
* - Feather M0 WiFi (WINC1500), WiFi 101 shield, or WINC1500 Breakout
1515
1616
created 13 July 2010
1717
by dlf (Metodo2 srl)
@@ -26,6 +26,7 @@
2626
#define WINC_CS 8
2727
#define WINC_IRQ 7
2828
#define WINC_RST 4
29+
#define WINC_EN 2 // or, tie EN to VCC and comment this out
2930

3031
Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);
3132

@@ -51,6 +52,11 @@ char server[] = "www.adafruit.com"; // name address for Google (using DNS)
5152
Adafruit_WINC1500Client client;
5253

5354
void setup() {
55+
#ifdef WINC_EN
56+
pinMode(WINC_EN, OUTPUT);
57+
digitalWrite(WINC_EN, HIGH);
58+
#endif
59+
5460
while (!Serial) {
5561
; // wait for serial port to connect. Needed for native USB port only
5662
}
@@ -68,15 +74,20 @@ void setup() {
6874
}
6975

7076
// attempt to connect to Wifi network:
71-
while (status != WL_CONNECTED) {
77+
while (WiFi.status() != WL_CONNECTED) {
7278
Serial.print("Attempting to connect to SSID: ");
7379
Serial.println(ssid);
7480
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
7581
status = WiFi.begin(ssid, pass);
7682

7783
// wait 10 seconds for connection:
78-
delay(10000);
84+
uint8_t timeout = 10;
85+
while (timeout && (WiFi.status() != WL_CONNECTED)) {
86+
timeout--;
87+
delay(1000);
88+
}
7989
}
90+
8091
Serial.println("Connected to wifi");
8192
printWifiStatus();
8293

0 commit comments

Comments
 (0)