I have an Uno and Ethernet Shield with a DS18B20 temp sensor. The first problem I have is that the web page colors do not match any of the html color charts I can find on the web. I'm trying for an aqua blue back ground. The color charts list it as #00FFCC, but this displays as a bright green. Below is how I've formatted it:
client.println("<body bgcolor=""#00FFCC::>");
The second question is in regards to centering text on the web page. I was able to successfully center the text prior to the printing the temperature measurement. But the temp measurement is printing on the following line when I use . Below is the code:
client.print("Hut Temperature is ");
client.print(temperature);
client.println("
");
What is the :: in that value for? Why is there a double double quote before the value (which becomes one later) but not a double double quote after it? I think, when you look at the stuff actually sent to the browser, that you'll see that you are sending it nonsense.
What is the :: in that value for? Why is there a double double quote before the value (which becomes one later) but not a double double quote after it? I think, when you look at the stuff actually sent to the browser, that you'll see that you are sending it nonsense.
The "" is concatenating string constants. That functionality is usually used for splitting long strings across lines for readablilty:
client.println("<body bgcolor="
"#00FFCC>");
And what the :: is about is anyone's guess. It's the :: that is causing the colour change. I guess that the browser is unable to parse the blue component (CC: of the colour with that in there, as the green component (FF) is parsed fine.
It does more than that. In the case where one wants to print a ", one can do that using "" in the string. Since the color value is normally in quotes, and the string to be sent to the client is in quotes, there are three choices. The value can be in single quotes, instead of double quotes. The single double quote before and after the value can be doubled up. Or, the single double quote before and after the value can be escaped. The first is easiest. The third is clearest. None of the choices matches what OP did.
I don't know what version of C you're using, but that's not what it does for me:
matt@laptop01:~$ cat test.c
#include <stdio.h>
void main()
{
printf("""This is a test""\n");
}
matt@laptop01:~$ cc -o test test.c
matt@laptop01:~$ ./test
This is a test
matt@laptop01:~$
According to what you just said that should have been surrounded by double quotes. Instead it appears to be concatenating strings literals...
Thanks for everyone's replies. I am new to programming and the Arduino. Removing :: solved the color issue. I saw them included as a part of a larger example.
Any ideas regarding centering the temperature measurement? Here is the source code from the browser:
majenko:
And what the :: is about is anyone's guess.
I can't see any reason for it. Perhaps it's a typo and was supposed to be a pair of double quotes to close the quoted attribute value? That would make sense at that point imo.