I have an ESP32 microcontroller that runs a mini web server. It is used to control the barrier. You approach the barrier, connect to it as a WiFi point, log in via IP, and click open. This is very inconvenient, especially if there are many people with access. Is it possible to make access directly from the world?
#include <Arduino.h>
#include <WiFi.h>
#include <WebServer.h>
WebServer server(80);
bool needsOpened = false;
bool realOpened = false;
...
void setup() {
...
Serial.println("Run web server");
server.on("/wicket/open", [] {
needsOpened = true;
Serial.println("OPEN Barrier");
redirect("/");
});
server.on("/wicket/close", [] {
needsOpened = false;
Serial.println("CLOSE Barrier");
redirect("/");
});
server.on("/", indexPage);
server.begin();
}