I'm trying to use the library in my project. An implementation with wm.setConfigPortalBlocking(false) is needed, but when a large delay is used in the loop, the portal either does not work at all, or it freezes very much and the web interface does not load. What can be done?
For example:
#include <WiFiManager.h>
WiFiManager wm;
void setup() {
WiFi.mode(WIFI_STA);
Serial.begin(9600);
wm.setConfigPortalBlocking(false);
if(wm.autoConnect("TEST-AP")){
Serial.println("connected...yeey :)");
}
else {
Serial.println("Configportal running");
}
}
void loop() {
wm.process();
Serial.print(".");
delay(60000);
}
1 Answer 1
Use a shorter delay.
WiFiManager only gets to run when you call wm.process()
. When you use a large delay you prevent it from doing any processing during that time, as you saw. This is the way it works. If you want it to work best, don't use a delay at all.
-
there is no way to get working portal with another lib or code with big delay? am i right?MolekulaTepla– MolekulaTepla08/26/2024 05:26:23Commented Aug 26, 2024 at 5:26
-
Why do you think you need a big delay? You almost certainly don't.romkey– romkey08/26/2024 16:50:18Commented Aug 26, 2024 at 16:50
-
because in the loop i sending data from sensors to google script and i need them only once per 60 secMolekulaTepla– MolekulaTepla08/28/2024 12:04:57Commented Aug 28, 2024 at 12:04
-
So you write your loop to send data only one per 60 seconds. You can do other stuff during that time, you don't have to not do anything for 60 seconds.romkey– romkey08/28/2024 15:00:05Commented Aug 28, 2024 at 15:00
blinkWithoutDelay
example sketch in the Arduino IDE