global variable
color = in this place i don't know whitch will best variable;
bfill.emit_p(PSTR(
"HTTP/1.0 200 OK\r\n"
"Content-Type: text/html\r\n"
"Pragma: no-cache\r\n"
"\r\n"
"<meta http-equiv='refresh' content='6'/>"
"<title>BodyColor</title>"
"<body style='background-color:$D'>"),
color);
return bfill.position();
void loop()
{
if ((temperature > 60) || (humadity > 55) ) {
color = in this place i don't know whitch will best variable ;
}
else {
color = in this place i don't know whitch will best variable;}
}
Hey,
I do not know how to pass variables to the page background changed from green to red when the condition 'if' is met. Someone help.
I have webserwer with temerature and humadity measure. I want to change background color when temp. or humad. exeed some set value. Normal background should be green, after exeed some set val. sholud be change to red. That's all. Which variable will better use, sending to my HTML string. Color variables in HTML can be name=red, hex=#fff or rgb=255,22,0. In my code , variable name is "color" but in HTML is set $D. I corrected my first code.
You can't put a variable ('color', whatever it's type is) into a fixed PSTR (in program memory).
You'll need a sprintf() for including a variable.
HTML is looking for a string so just make your 'color' variable a cstring, "red" or "green" or whatever hex codes HMTL wants.