diff --git a/README.md b/README.md index 5557da0..10da7f6 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,9 @@ First attempt at a library. Lots more changes and fixes to do. Contributions are - choose one of the access points scanned, enter password, click save - ESP will try to connect. If successful, it relinquishes control back to your app. If not, reconnect to AP and reconfigure. +## How It Looks +![ESP8266 WiFi Captive Portal Homepage](http://i.imgur.com/YPvW9eql.png) ![ESP8266 WiFi Captive Portal Configuration](http://i.imgur.com/oicWJ4gl.png) + ## Wishlist - [x] remove dependency on EEPROM library - [x] move HTML Strings to PROGMEM diff --git a/examples/.DS_Store b/examples/.DS_Store index d369dc2..fcd6f5a 100644 Binary files a/examples/.DS_Store and b/examples/.DS_Store differ diff --git a/examples/Basic_WiFiManager/Basic_WiFiManager.ino b/examples/Basic_WiFiManager/Basic_WiFiManager.ino deleted file mode 100755 index ed7b60e..0000000 --- a/examples/Basic_WiFiManager/Basic_WiFiManager.ino +++ /dev/null @@ -1,159 +0,0 @@ -/* NETPIE ESP8266 basic sample */ -/* More information visit : https://netpie.io */ - -#include -#include - -//needed for library -#include -#include -#include -#include //https://github.com/tzapu/WiFiManager - -//for LED status -#include -Ticker ticker; - -#define APPID "APPID" -#define KEY "APPKEY" -#define SECRET "APPSECRET" -#define ALIAS "esp8266" - -WiFiClient client; - -int timer = 0; -MicroGear microgear(client); - -void tick() -{ - //toggle state - int state = digitalRead(BUILTIN_LED); // get the current state of GPIO1 pin - digitalWrite(BUILTIN_LED, !state); // set pin to the opposite state -} - -//gets called when WiFiManager enters configuration mode -void configModeCallback (WiFiManager *myWiFiManager) { - Serial.println("Entered config mode"); - Serial.println(WiFi.softAPIP()); - //if you used auto generated SSID, print it - Serial.println(myWiFiManager->getConfigPortalSSID()); - //entered config mode, make led toggle faster - ticker.attach(0.2, tick); -} - -/* If a new message arrives, do this */ -void onMsghandler(char *topic, uint8_t* msg, unsigned int msglen) { - Serial.print("Incoming message --> "); - msg[msglen] = '\0'; - Serial.println((char *)msg); -} - -void onFoundgear(char *attribute, uint8_t* msg, unsigned int msglen) { - Serial.print("Found new member --> "); - for (int i=0; i "); - for (int i=0; i= 1000) { - Serial.println("Publish..."); - - /* Chat with the microgear named ALIAS which is myself */ - microgear.chat(ALIAS,"Hello"); - timer = 0; - } - else timer += 100; - } - else { - Serial.println("connection lost, reconnect..."); - if (timer >= 5000) { - microgear.connect(APPID); - timer = 0; - } - else timer += 100; - ticker.detach(); - } - delay(100); -} diff --git a/examples/Basic_WiFiManager_DisconnectWiFi/Basic_WiFiManager_DisconnectWiFi.ino b/examples/Basic_WiFiManager_DisconnectWiFi/Basic_WiFiManager_DisconnectWiFi.ino deleted file mode 100755 index 5f4d8b7..0000000 --- a/examples/Basic_WiFiManager_DisconnectWiFi/Basic_WiFiManager_DisconnectWiFi.ino +++ /dev/null @@ -1,178 +0,0 @@ -/* NETPIE ESP8266 basic sample */ -/* More information visit : https://netpie.io */ - -#include -#include - -//needed for library -#include -#include -#include -#include //https://github.com/tzapu/WiFiManager - -//for LED status -#include -Ticker ticker; - -#define APPID "APPID" -#define KEY "APPKEY" -#define SECRET "APPSECRET" -#define ALIAS "esp8266dev" - -WiFiClient client; - -int timer = 0; -int timeoutConnection = 0; -MicroGear microgear(client); - -void tick() -{ - //toggle state - int state = digitalRead(BUILTIN_LED); // get the current state of GPIO1 pin - digitalWrite(BUILTIN_LED, !state); // set pin to the opposite state -} - -//gets called when WiFiManager enters configuration mode -void configModeCallback (WiFiManager *myWiFiManager) { - Serial.println("Entered config mode"); - Serial.println(WiFi.softAPIP()); - //if you used auto generated SSID, print it - Serial.println(myWiFiManager->getConfigPortalSSID()); - //entered config mode, make led toggle faster - ticker.attach(0.2, tick); -} - -/* If a new message arrives, do this */ -void onMsghandler(char *topic, uint8_t* msg, unsigned int msglen) { - Serial.print("Incoming message --> "); - msg[msglen] = '\0'; - Serial.println((char *)msg); -} - -void onFoundgear(char *attribute, uint8_t* msg, unsigned int msglen) { - Serial.print("Found new member --> "); - for (int i=0; i "); - for (int i=0; i= 1000) { - Serial.println("Publish..."); - - /* Chat with the microgear named ALIAS which is myself */ - microgear.chat(ALIAS,"Hello"); - timer = 0; - } - else timer += 100; - } - else { - Serial.println("connection lost, reconnect..."); - if (timer >= 5000) { - microgear.connect(APPID); - timeoutConnection++; - timer = 0; - } - else timer += 100; - - if(timeoutConnection==6){ - if(WiFi.status()==WL_CONNECTED){ - WiFi.disconnect(); - } - initWiFi(); - } - ticker.detach(); - } - } - delay(100); -}