From 2610dcb2c5d7dd87ad431106d560476d5968752f Mon Sep 17 00:00:00 2001 From: Shawn A Date: Fri, 7 Sep 2018 15:52:52 -0500 Subject: [PATCH] change simple to basic clean up --- examples/Basic/Basic.ino | 37 +++++++++++++++++++++++++++++++++++++ examples/Simple/Simple.ino | 31 ------------------------------- 2 files changed, 37 insertions(+), 31 deletions(-) create mode 100644 examples/Basic/Basic.ino delete mode 100644 examples/Simple/Simple.ino diff --git a/examples/Basic/Basic.ino b/examples/Basic/Basic.ino new file mode 100644 index 0000000..26ec6d4 --- /dev/null +++ b/examples/Basic/Basic.ino @@ -0,0 +1,37 @@ +#include // https://github.com/tzapu/WiFiManager + +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 wm; + + //reset settings - wipe credentials for testing + //wm.resetSettings(); + + // Automatically connect using saved credentials, + // if connection fails, it starts an access point with the specified name ( "AutoConnectAP"), + // if empty will auto generate SSID, if password is blank it will be anonymous AP (wm.autoConnect()) + // then goes into a blocking loop awaiting configuration and will return success result + + bool res; + // res = wm.autoConnect(); // auto generated AP name from chipid + // res = wm.autoConnect("AutoConnectAP"); // anonymous ap + res = wm.autoConnect("AutoConnectAP","password"); // password protected ap + + if(!res) { + Serial.println("Failed to connect"); + // ESP.restart(); + } + else { + //if you get here you have connected to the WiFi + Serial.println("connected...yeey :)"); + } + +} + +void loop() { + // put your main code here, to run repeatedly: + +} diff --git a/examples/Simple/Simple.ino b/examples/Simple/Simple.ino deleted file mode 100644 index e244fde..0000000 --- a/examples/Simple/Simple.ino +++ /dev/null @@ -1,31 +0,0 @@ -#include // https://github.com/tzapu/WiFiManager - -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 wm; - - //reset settings - wipe credentials for testing - //wm.resetSettings(); - - //set custom ip for portal - //wm.setAPStaticIPConfig(IPAddress(10,0,1,1), IPAddress(10,0,1,1), IPAddress(255,255,255,0)); - - //automatically connect using saved credentials if they exist - //If connection fails it starts an access point with the specified name - //here "AutoConnectAP" if empty will auto generate basedcon chipid, if password is blank it will be anonymous - //and goes into a blocking loop awaiting configuration - wm.autoConnect("AutoConnectAP"); - //or use this for auto generated name ESP + ChipID - //wm.autoConnect(); - - //if you get here you have connected to the WiFi - Serial.println("connected...yeey :)"); -} - -void loop() { - // put your main code here, to run repeatedly: - -}