examples updated

This commit is contained in:
Alex Tudorache
2015-12-09 09:37:23 +02:00
parent 614516596b
commit e36f7959c7
3 changed files with 22 additions and 23 deletions
+8 -3
View File
@@ -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
+7 -8
View File
@@ -1,10 +1,9 @@
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
//needed for library
#include <EEPROM.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //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
@@ -1,37 +1,32 @@
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
//needed for library
//#include <EEPROM.h>
//#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> //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