Connecting the mysterious HTML dots

<!DOCTYPE html>
<html>
<body style="background-color:powderblue;">

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>

Right, I understand. But unless you send those commands in an HTML.h file attached to the sketch code there is difficulty in just using "client.println" statements depending on what you are trying to accomplish. I have the SuperMon examples I have played with but that only applies to ESPs. I would like to be able to do similar thngs with the UNO WiFi Rev2 as well, which is a totally different animal.

The other example I linked shows how to send the html tags with client. Print. The body tag should be much the same - try it and see?

Not really, you can send them as const char * and put these parts in PROGMEM to save RAM,

An eye opener for was

<pre> This Paragraph has         spaces</pre>

and HTML forms are an easy way to make a page inter-active

I have actually loaded and looked at that code you referenced and it performs as designed.
Where I get into trouble is trying to send the HTML command for, say, a background color change. Do you have to send each segment individually? I have tried but get a compiler parse error sending this:

client.println("<body style="background-color:powderblue;">");

...compiler error: unable to find string literal operator 'operator""backgound' with 'const char [13]', 'unsigned int' arguments

...leave the quotes out and it shows up on the screen as plain text... which makes me think client.print has limitations for passing HTML to a browser.... I dunno.... I am too inexperienced to know for sure....

You need to put a backslash before the quotes intended to be part of your html.

I. E

Client. Println(“background =\”blue\” “);

Not usable - I’m using a phone but it shows how to escape the quotes.

HTML also allows for a single ' as an alias for "

Client. Println(“background ='blue' “);`

(oh that was a life changer as well for me, everything became more readable)

Quote marks like this " " are used to mark the beginning and end of the text you want to print (for your client.println statement, for example.)
When you use those quote marks in the middle of the text you want to print, the compiler gets confused and has no idea what you want to do.
That is why, if you want to print a quote mark like this: "
you have to escape it by putting a backslash in front, like this: \"

So, what you need your line of code to look like is this:
client.println("<body style=\"background-color:powderblue;\">");
Notice where I put the backslashes. They tell the compiler: "Treat this quote mark as an actual quote mark, not as the end of the string to be printed."

I could be mistaken, but I believe that single quotes require the backslash, too.

You are mistaken. Single quotes require a backslash when they are in between single quotes

char c = '\'';

but then i guess

char c = '"'; 

is ok as well.

I'm nearer to a real computer today. If you haven't figured it out and still need assistance, please post all your code.

Today is the first day in several that I have been able to try and sit down at a computer after my lower back decided to go out again. The vagaries of old age; you young whippersnappers need to enjoy life to the hilt while you can. LOL...

I will keep your offer in mind Wildbill. :+1: :+1:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.