Hi, i've passed all night testing different solutions for this problem but everyone had some issue.
I'm trying to do a simple thing but can't seem to get it work.
Actually I have this working situation :
client.println(F("<input type=button value='Main On' style=background-color:#ff9999;width:105px;height:42px onmousedown=location.href='/?mainOn'>"));
client.println(F("<input type=button value='Main Off' style=background-color:#ff9999;width:105px;height:42px onmousedown=location.href='/?mainOff'>"));
if (readString.indexOf("/?mainOn") > 0) main = 1;
if (readString.indexOf("/?mainOff") > 0) main = 0;
Now, as you can guess, i will have a button for turning On and one for turning Off.
I have many things to turn On and Off so i will have to duplicate my buttons filling my webpage.
What I would like is a Single On/Off html button for each thing i have to turn on or off.
I've done this, but it does not work :
client.println(F("<input type=button value='Main On/Off' style=background-color:#ff9999;width:105px;height:42px onmousedown=location.href='/?mainOnOff'>"));
if (readString.indexOf("/?mainOnOff") > 0)
{ if main ==0 main=1; //it was Off so i turn On
else main = 0; // it was On so i turn Off
}
The rest of the code shows the effect of buttons in an IFRAME using this code :
client.print(F("<td><b>Main is </b></td><td>"));
if (main == 0) client.println( F("<b><font color ='GREEN' >OFF</font></b></td></tr><tr bgcolor='#b3ffff'>") );
else client.println( F("<b><font color ='RED' >ON</font></b></td></tr><tr bgcolor='#b3ffff'>") );
Any suggestions?