Connect to the microcontroller directly from the world. Is this possible?
Posted: Tue Jun 17, 2025 7:50 am
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?
sketch:
sketch:
Code: Select all
#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();
}