I have a project using ESP32 and Arduino to set up a simple web server which works okay, using libraries:
#include <WebServer.h>
#include <WiFi.h>
But I'm a bit stuck with a seemingly simple problem; how do I get user input back to a string in the ESP32?
I have tried examples found online but can't get it to work. Something seems to be missing.
My code serves a web page with the following elements to try to get SSID from the user:
SSID
Save
which creates an input text box for the user to type into and a save button to send the string.
This displays correctly on a browser.
In the ESP32 Arduino code I have the following:
void handle_OnConnect(){ // this is called when home web page is requested
LEDStatus = LOW;
if(server.method() == HTTP_ANY) { // try
String ssid = server.arg("ssid");
Serial.print("got value: ");
Serial.println(ssid);
}
Serial.println("web request");
server.send(200, "text/html", getMainPageHTML());
}
But this code never gets triggered. I don't believe my HTML code is causing the browser to send anything back to the server!
Does anybody have any tips or examples I that will help me figure this out?