I am building a Single Page Application for Arduino. It graphically displays analog pin values on a wifi connected tablet.
I have built the sketch but want to clean it up. I have been able to upload a sketch to my (Uno Wifi Rev 2) Arduino, initialize the Wifi, and connect to it with a tablet. I am able send the static page "frame" to the tablet. That static frame is able to request and receive Arduino analog pin values using the XMLHttpRequest object.
But sending the bulky static page is clunky. Tutorials do stuff like,
client.println("<html><body>");
client.println("Hello World!");
client.println("</body></html>");
I tried to get slick and create a FileText.h header file:
#define constFileText=
"<html><body>"
"Hello World!"
"</body></html>";
and combine that with:
#include "FileText.h"
client.println(constFileText);
What I would like to do is create a standard FileText.html:
Hello World!
And process it with something like:
ifstream hFile ("FileText.html");
while (getline(hFile, strLine))
client.println(strLine);
That would make it much easier to edit the html file. It would eliminate the waste of including all those serial.println calls. It would also eliminate the maximum length constraint on constant values.
Is there any way to provide a text file to the Arduino compiler and have the Arduino Server send it to the Arduino's client?