So you're a Noob? Post your questions here until you graduate! Don't be shy.
User avatar
By philbowles
#72348
potz wrote:Thanks!

A question more: how to recover the button state ?

I would like to pre-checked the button in the last state.

thanks


Code: Select allclient.println("<input type=\"radio\" name=\"RedLEDState\" value=\"RED_OFF\" "
+ (digitalRead(button) ? "checked=\"checked\"":"") +"> OFF<br>");

or something similar...
User avatar
By potz
#72355 Thanks everybody!

@philbowles I was not clear on my question! I don't want to read any hardware button but this software radio button. (When you create the button you can use the option checked), but after use, if you change the button's state and goes to an other page an be back, the option checked will be again displayed. I would like to see the real/actual button state.

I'm not 100% sure to be clear... sorry :(
User avatar
By villTech
#72362 you can attach the radio button to a variable in your esp8266 (server).
change the variable on tick of your button.
read the variable when loading your button on your web page. variable value will tell if your button is checked or not.
User avatar
By potz
#72378 @Barnabybear sure it's more clear with ' !

@villTech, right but how to attribute a variable to a "radio switch button" ?

Thanks