Web calculator

Hello everyone. Sorry for the trouble.
I have to build a web calculator with Arduino using the ESP32 module as a server interface.

In a nutshell, I would like to insert the data to be calculated on the web page, take it and send it to Arduino, which performs the calculation and sends it back to the server, displaying it on the web page. Thanks to everyone who will help me!

What have you tried so far ?

When is our assignment due ?

Hi friend, thanks for the help. So far I have created a small web interface with two fields to enter the values ​​to send to arduino. First of all, how can I get the values ​​entered on the web page and then send them to Arduino? I am attaching the code I created for the server.

#include <WiFi.h>
HardwareSerial in(1);

const char *apSsid = "ODROID_GO_AP";
const char *apPasswd = "12345678";

WiFiServer server(80);

void setup() {
Serial.begin(115200);
in.begin(9600, SERIAL_8N1, 15, 4);
IPAddress gateway(192, 168, 4, 1);
IPAddress subnet(255, 255, 255, 0);

if (WiFi.softAP(apSsid, apPasswd)) {
Serial.println("Wifi AP established.");
Serial.print("Wifi AP IP: ");
Serial.println(WiFi.softAPIP());
Serial.print("AP SSID: ");
Serial.println(apSsid);
Serial.print("AP Password: ");
Serial.println(apPasswd);

server.begin();

} else {
Serial.println("Wifi AP establishing failed.");
}

}

void loop() {
//GO.update();
// GO.lcd.println(String(in.readString()));
WiFiClient client = server.available();

if (client) {
Serial.println("New Client.");
String currentLine = "";
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
if (c == '\n') {
if (currentLine.length() == 0) {
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();
client.print("");
client.print("<input type="number" step="0.01" name="op1" value="">");
client.print("<select name = "operation">");
client.print("<option value="+">+");
client.print("<option value="-">-");
client.print("<option value="/">:");
client.print("<option value="">");
client.print("<input type="number" step="0.01" name="op2" value="">");
client.print("<input type="submit" value="invio">");
client.print("<input type="reset" value="ripristina">");
client.print("");
client.print("");
client.println();

break;
} else {
currentLine = "";
}
} else if (c != '\r') {
currentLine += c;
}

}
}
client.stop();
}

// put your main code here, to run repeatedly:
}

I am attaching the code I created for the server.

Please read this sticky post read this before posting a programming question and follow its advice about posting code. Basically, Auto format it in the IDE and use code tags or Copy for Forum from the IDE to make the code easier for others to copy to an editor for examination and comment

#include <WiFi.h>
HardwareSerial in(1);

const char *apSsid = "ODROID_GO_AP";
const char *apPasswd = "12345678";


WiFiServer server(80);

void setup() {
  Serial.begin(115200);
 in.begin(9600, SERIAL_8N1, 15, 4);
    IPAddress gateway(192, 168, 4, 1);
    IPAddress subnet(255, 255, 255, 0);
 
    if (WiFi.softAP(apSsid, apPasswd)) {
        Serial.println("Wifi AP established.");
        Serial.print("Wifi AP IP: ");
        Serial.println(WiFi.softAPIP());
        Serial.print("AP SSID: ");
        Serial.println(apSsid);
        Serial.print("AP Password: ");
        Serial.println(apPasswd);
 
        server.begin();
 
        
    } else {
        Serial.println("Wifi AP establishing failed.");
    }
  
 

 
}

void loop() {
  //GO.update();
 // GO.lcd.println(String(in.readString()));
 WiFiClient client = server.available();
 
    if (client) {
        Serial.println("New Client.");
        String currentLine = "";
        while (client.connected()) {
            if (client.available()) {
                char c = client.read();
                Serial.write(c);
                if (c == '\n') {
                    if (currentLine.length() == 0) {
                        client.println("HTTP/1.1 200 OK");
                        client.println("Content-type:text/html");
                        client.println();
                        client.print("<form action='http://192.168.4.1/submit' method='POST'>");
                        client.print("<input type=\"number\" step=\"0.01\" name=\"op1\" value=\"\">");
                        client.print("<select name = \"operation\">");
                        client.print("<option value=\"+\">+</option>");
                        client.print("<option value=\"-\">-</option>");
                        client.print("<option value=\"/\">:</option>");
                        client.print("<option value=\"*\">*</option>");
                        client.print("<input type=\"number\" step=\"0.01\" name=\"op2\" value=\"\">");
                        client.print("<input type=\"submit\" value=\"invio\">");
                        client.print("<input type=\"reset\" value=\"ripristina\">");
                        client.print("</select>");
                        client.print("</form>");
                        client.println();
                        
                        break;
                    } else {
                        currentLine = "";
                    }
                } else if (c != '\r') {
                    currentLine += c;
                }

            }
        }
        client.stop();
    }
  
  // put your main code here, to run repeatedly:
}

(deleted)

Different username, same question, same IP address, over in the Italian section of the forum

Michelinho94:
In a nutshell, I would like to insert the data to be calculated on the web page, take it and send it to Arduino, which performs the calculation and sends it back to the server, displaying it on the web page. Thanks to everyone who will help me!

You do realize that can be done entirely in the web server on the ESP32? A few lines of very simple javascript in the HTML for the web page is all it would take. Sending the data to an Arduino is a rather silly way to do it...

Regards,
Ray L.