After numerous setbacks I finally have most of my code working.
The problem is that it times out after about a minute, and I would like no timeout.
This is mostly taken from the example under "WiFiManagerNonBlocking, and is as follows.
All I have added is the "while" loop.
//
// Below is fine, provided a network is selected within about a minute.
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
WiFiManager wm;
void setup() {
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
// put your setup code here, to run once:
Serial.begin(115200);
//reset settings - wipe credentials for testing
//wm.resetSettings();
wm.setConfigPortalBlocking(false);
wm.setConfigPortalTimeout(600000); // Originally 60, but makes no difference
//automatically connect using saved credentials if they exist
//If connection fails it starts an access point with the specified name
if (wm.autoConnect("AutoConnectAP")) {
Serial.println("connected...yeey :)");
}
else {
Serial.println("Configportal running");
while (WiFi.status() != WL_CONNECTED) {
// FLASH RED/GREEN LEDS
Serial.println("======== start flash ===========================");
pinMode( 13, OUTPUT ); // Green LED
pinMode( 15, OUTPUT); // Red LED
for (int i = 100; i >= 0; i--) { // do it 50 times, or about 7 second!
wm.process();
//Turn Red On and green off; then reverse; 0.1 sec/cycle
digitalWrite(15, HIGH); // Red
digitalWrite(13, LOW ); // Green
delay(90);
digitalWrite(13, HIGH); // Green
digitalWrite(15, LOW ); // Red
delay(90);
} // end of flash for
} // end while
} // end else
} // end setup
void loop() {
wm.process();
// put your main code here, to run repeatedly:
}
I have added a "while" loop if no network is found and "ConfigPortal" is running..
I flash the LEDs to alert the user to do something.
I also don't understand the line " wm.process();" - but this seems to be needed.
All I need is a command to allow more time for configuration.