Esp8266 Html Form als Arduino Tab.
HtmlForm.ino
// ****************************************************************
// Sketch Esp8266 Html Form Modular(Tab)
// created: Jens Fleischer, 2020-09-27
// last mod: Jens Fleischer, 2021-05-22
// For more information visit: https://fipsok.de
// ****************************************************************
// Hardware: Esp8266
// Software: Esp8266 Arduino Core 2.4.2 - 3.1.0
// Getestet auf: Nodemcu, Wemos D1 Mini Pro, Sonoff Dual
/******************************************************************
Copyright (c) 2020 Jens Fleischer. All rights reserved.
This file is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
*******************************************************************/
// Diese Version von Html Form sollte als Tab eingebunden werden.
// #include <ESP8266WebServer.h> müssen im Haupttab aufgerufen werden
// Die Funktionalität des ESP8266 Webservers ist erforderlich.
// Die Funktion "setupForm();" muss im Setup aufgerufen werden.
/**************************************************************************************/
uint32_t setID; // Diese Variable Deklaration in den Haupttab vor "setup()" verschieben um sie im gesamten Sketch verfügbar zu machen.
void setupForm() {
server.on("/form.html", []() {
if (server.args()) setID = atoll(server.arg(0).c_str());
String temp = R"(<!DOCTYPE HTML>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ESP8266</title>
<style>
body, form {
display: flex;
flex-flow: column;
justify-content: space-around;
height: 10em;
}
body {
align-items: center;
}
</style>
</head>
<body>
<h2>Html Form ESP8266</h2>
<form method="POST">
<label>Aktuell: )";
temp += setID;
temp += R"(</label>
<input type="number" name="uint" min="0" max="4294967295" autofocus required>
<button>Senden</button>
</form>
</body>
</html>)";
server.send(200, "text/html", temp);
});
}