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

Commit

Permalink
more sleepy mode support, an AP webserver (tested!)
Browse files Browse the repository at this point in the history
  • Loading branch information
ladyada committed Jan 26, 2016
1 parent 0e25013 commit 08ad733
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
31 changes: 24 additions & 7 deletions examples/ConnectWithWEP/ConnectWithWEP.ino
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,38 @@
D0D0DEADF00DABBADEAFBEADED will work because it's 26 characters,
all in the 0-9, A-F range.
Circuit:
* WiFi shield attached
* Circuit:
* - Feather M0 WiFi (WINC1500), WiFi 101 shield, or WINC1500 Breakout
created 13 July 2010
by dlf (Metodo2 srl)
modified 31 May 2012
by Tom Igoe
*/
#include <SPI.h>
#include <WiFi101.h>
#include <Adafruit_WINC1500.h>

#define WINC_CS 8
#define WINC_IRQ 7
#define WINC_RST 4
#define WINC_EN 2 // or, tie EN to VCC and comment this out

Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);

// Default Hardware SPI (SCK/MOSI/MISO), SS -> #10, INT -> #7, RST -> #5, EN -> 3-5V
//Adafruit_WINC1500 WiFi;

char ssid[] = "yourNetwork"; // your network SSID (name)
char key[] = "D0D0DEADF00DABBADEAFBEADED"; // your network key
int keyIndex = 0; // your network key Index number
int status = WL_IDLE_STATUS; // the Wifi radio's status

void setup() {
#ifdef WINC_EN
pinMode(WINC_EN, OUTPUT);
digitalWrite(WINC_EN, HIGH);
#endif

//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
Expand All @@ -45,13 +60,17 @@ void setup() {
}

// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
while (WiFi.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);
uint8_t timeout = 10;
while (timeout && (WiFi.status() != WL_CONNECTED)) {
timeout--;
delay(1000);
}
}

// once you are connected :
Expand Down Expand Up @@ -123,5 +142,3 @@ void printCurrentNet() {
Serial.println();
}



5 changes: 5 additions & 0 deletions src/Adafruit_WINC1500.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,5 +700,10 @@ int8_t Adafruit_WINC1500::setSleepMode(uint8_t pstype, uint8_t bcasten) {
return m2m_wifi_set_sleep_mode(pstype, bcasten);
}

int8_t Adafruit_WINC1500::requestSleep(uint32_t ms) {
return m2m_wifi_request_sleep(ms);
}


// let us define in main program, with optional pins!
//Adafruit_WINC1500 WiFi;
1 change: 1 addition & 0 deletions src/Adafruit_WINC1500.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class Adafruit_WINC1500
void refresh(void);

int8_t setSleepMode(uint8_t pstype, uint8_t bcasten);
int8_t requestSleep(uint32_t ms);
private:
int _init;
char _version[9];
Expand Down

0 comments on commit 08ad733

Please sign in to comment.