ESP32 WebServer HTML DataTime Piker

MicheliBarcello
Posts: 6
Joined: Tue Apr 05, 2022 5:28 pm

ESP32 WebServer HTML DataTime Piker

Postby MicheliBarcello » Tue Apr 05, 2022 5:32 pm

Good morning people, everything fine ?

I'm programming an ESP32 with the Arduino IDE, I managed to do the same to connect to the internet and become a Server.

I have a question in the HTML part.

I would like to put a “DataTime Piker” and a button to turn the timer on/off

Here's a picture of what you'd like.

How is the HTML programming done for the page to be displayed to look like this?

Thank you in advance, thank you

Code: Select all

#include <WiFi.h>
const char* ssid = "Home";
const char* pass = "12345678";
int LED = 2;

bool on_off;
int Hour;
int Min;

WiFiServer server(80);

void setup() {
  pinMode(LED, OUTPUT);
  Serial.begin(115200);
  WiFi.begin(ssid, pass);
  Serial.print("Conectando Wifi");

  while (WiFi.status() != WL_CONNECTED ) {
    Serial.print(".");
    delay(5000);
    WiFi.begin(ssid, pass);
  }
  Serial.println("");
  Serial.print("IP: ");
  Serial.println(WiFi.localIP());
  Serial.print("MAC Address: ");
  Serial.println(WiFi.macAddress());
  server.begin();
}


void loop() {
  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();

            // HTML Problem
            // HTML Problem
            // HTML Problem

            break;
          } else {
            currentLine = "";
          }
        }
        else if (c != '\r') {
          currentLine += c;
        }
      }
    }
    client.stop();
    Serial.println("Client Disconnected.");
  }
}
Attachments
Problem.png
Problem.png (13.99 KiB) Viewed 1075 times

Who is online

Users browsing this forum: No registered users and 57 guests