From e36f7959c79d01d9d3f657272c838c530f22d47e Mon Sep 17 00:00:00 2001 From: Alex Tudorache Date: Wed, 9 Dec 2015 09:37:23 +0200 Subject: [PATCH] examples updated --- README.md | 11 ++++++++--- examples/AutoConnect/AutoConnect.ino | 15 +++++++-------- .../AutoConnectWithTimeout.ino | 19 +++++++------------ 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index a573c33..b1d2d39 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,16 @@ First attempt at a library. Lots more changes and fixes to do. Contributions are This works with the ESP8266 Arduino platform https://github.com/esp8266/Arduino ## Releases -> v0.3 removed the need for EEPROM and works with the 2.0.0 and above stable release of the ESP8266 for Arduino IDE package +#### v0.3 + - removed the need for EEPROM and works with the 2.0.0 and above stable release of the ESP8266 for Arduino IDE package + - removed restart on save of credentials + - updated examples -> **v0.2 and newer need the latest staging version (or at least a recent release of the staging version) to work** +##### v0.2 +needs the latest staging version (or at least a recent release of the staging version) to work -> v0.1 works with the staging release ver. 1.6.5-1044-g170995a, built on Aug 10, 2015 of the ESP8266 Arduino library. +##### v0.1 +works with the staging release ver. 1.6.5-1044-g170995a, built on Aug 10, 2015 of the ESP8266 Arduino library. ## Quick Start diff --git a/examples/AutoConnect/AutoConnect.ino b/examples/AutoConnect/AutoConnect.ino index a0fb0f4..37ff392 100644 --- a/examples/AutoConnect/AutoConnect.ino +++ b/examples/AutoConnect/AutoConnect.ino @@ -1,10 +1,9 @@ #include //https://github.com/esp8266/Arduino //needed for library -#include -#include #include -#include //https://github.com/tzapu/WiFiManager +#include +#include //https://github.com/tzapu/WiFiManager void setup() { @@ -13,20 +12,20 @@ void setup() { //WiFiManager //Local intialization. Once its business is done, there is no need to keep it around - WiFiManager wifi; + WiFiManager wifiManager; //reset saved settings - //wifi.resetSettings(); + //wifiManager.resetSettings(); //set custom ip for portal - //wifi.setAPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); + //wifiManager.setAPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); //fetches ssid and pass from eeprom and tries to connect //if it does not connect it starts an access point with the specified name //here "AutoConnectAP" //and goes into a blocking loop awaiting configuration - wifi.autoConnect("AutoConnectAP"); + wifiManager.autoConnect("AutoConnectAP"); //or use this for auto generated name ESP + ChipID - //wifi.autoConnect(); + //wifiManager.autoConnect(); //if you get here you have connected to the WiFi diff --git a/examples/AutoConnectWithTimeout/AutoConnectWithTimeout.ino b/examples/AutoConnectWithTimeout/AutoConnectWithTimeout.ino index 4cd7920..c90cf10 100644 --- a/examples/AutoConnectWithTimeout/AutoConnectWithTimeout.ino +++ b/examples/AutoConnectWithTimeout/AutoConnectWithTimeout.ino @@ -1,37 +1,32 @@ #include //https://github.com/esp8266/Arduino //needed for library -//#include -//#include -#include #include +#include #include //https://github.com/tzapu/WiFiManager -//this intitilises the library, parameter is eeprom start - - void setup() { // put your setup code here, to run once: Serial.begin(115200); + //WiFiManager //Local intialization. Once its business is done, there is no need to keep it around - WiFiManager wifi; - + WiFiManager wifiManager; //reset settings - for testing - wifi.resetSettings(); + //wifiManager.resetSettings(); //sets timeout until configuration portal gets turned off //useful to make it all retry or go to sleep //in seconds - wifi.setTimeout(180); + wifiManager.setTimeout(180); - //fetches ssid and pass from eeprom and tries to connect + //fetches ssid and pass and tries to connect //if it does not connect it starts an access point with the specified name //here "AutoConnectAP" //and goes into a blocking loop awaiting configuration - if(!wifi.autoConnect("AutoConnectAP")) { + if(!wifiManager.autoConnect("AutoConnectAP")) { Serial.println("failed to connect and hit timeout"); delay(3000); //reset and try again, or maybe put it to deep sleep