0

State of a TOGGLE element
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

State of a TOGGLE element

by sjobris on Wed Dec 06, 2017 8:53 am

Hi everybody,

has someone an idea how to ask the state of e.g. a toggle element?

I managed to switch on and off a LED with my ESP8266 board using a toggle element on a dashboard.
Switching this toggle generates a kind of change event. On startup of my board there is no event because nobody is using the slider...
What I'm looking for is a command how to aks the present state of a toggle or slider or textbox etc.

Would be great if someone has a hint for me or directs me to a documenatation for this.

thanks in advance

sjobris

sjobris
 
Posts: 2
Joined: Tue Dec 05, 2017 5:38 pm

Re: State of a TOGGLE element

by btreichel on Wed Dec 06, 2017 10:27 am

I'd try a statement like below. Basically the bit of code that the on message executes when an event occurs. However, I would never start up a system w/o a chosen default state. If the person at the dashboard doesn't like it, they can change the toggle.

"slider_data = (data->toInt());"

btreichel
 
Posts: 75
Joined: Tue Jul 25, 2017 3:00 pm

Re: State of a TOGGLE element

by sjobris on Fri Dec 08, 2017 4:17 pm

Thanks for that,

I'll try this beginning of next week and report my results.

sjobris
 
Posts: 2
Joined: Tue Dec 05, 2017 5:38 pm

Please be positive and constructive with your questions and comments.