AutoConnect library doesn't allow to perform any other operation
Posted: Fri Oct 22, 2021 10:37 am
Hello everyone! I need to build an application in which my ESP32 uses the AutoConnect library (https://github.com/Hieromon/AutoConnect) for creating a captive portal and meanwhile performing other operations. The thing is that when I start the captive portal it doesn't perform any other operation. Here's reported some code.
For instance here, in the loop() method I can't see any message printed onto my serial monitor, as well as the print after Portal.begin() is being called seems to not be executed. How can I perform more actions while the captive portal is being initialized and started?
Code: Select all
#include <WiFi.h>
#include <WebServer.h>
#include <AutoConnect.h>
WebServer Server;
AutoConnect Portal(Server);
void rootPage() {
char content[] = "Hello, world";
Server.send(200, "text/plain", content);
}
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
Server.on("/", rootPage);
if (Portal.begin()) {
Serial.println("WiFi connected: " + WiFi.localIP().toString());
}
Serial.println("Print after Portal.begin()");
}
void loop() {
Portal.handleClient();
Serial.println("Perform an operation...");
delay(2000);
}