Peter Lynch Peter Lynch - 8 months ago 84
C Question

esp8266 html page code integrated into .ino file

I'm using an esp8266 and this is the HTML part of the program, I copy and pasted from the depths of the internet and want to change the HTML page of the file in what format can I add html code. thanks! (i was trying to put a text-input field in but I will want to put many html elements in later) code-

const String HtmlHtml = "<html><head>"
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" /></head>";`
`const String HtmlHtmlClose = "</html>";
const String HtmlTitle = "<h1>Arduino-er: ESP8266 AP WebServer exercise</h1><br/>\n";
const String HtmlLedStateLow = "<big>LED is now <b>ON</b></big><br/>\n";
const String HtmlLedStateHigh = "<big>LED is now <b>OFF</b></big><br/>\n";
const String HtmlButtons =
"<a href=\"LEDOn\"><button style=\"display: block; width: 100%;\">ON</button></a><br/>"
"<a href=\"LEDOff\"><button style=\"display: block; width: 100%;\">OFF</button></a><br/>";

Answer Source

I assume that you later have part where you combine your variables and make one big that you use to dispalay html. You can do something like this.

-Open your editor and copy/paste code from your post

-Edit it as you want

-Delete variables in code that you posted and replace with one, example

  const String wholePage = "INSERT YOUR HTML";

-And than on line where you added variables before just use your new where is whole HTML code

Hope it helps! :)