Updating a variable with a button

This forum contains common answers to questions and tutorials produced for the community.
marcio
Posts: 4
Joined: Mon Jan 17, 2011 1:53 pm

Updating a variable with a button

Post by marcio » Tue Feb 01, 2011 3:39 pm

i need to set a variable and 5 sends later set it to 0 with the push of a button
what are the steps to do this
Thank you
jpurdum
Enovation Controls Development
Enovation Controls Development
Posts: 153
Joined: Mon Jun 21, 2010 11:19 am

Re: Updating a variable with a button

Post by jpurdum » Thu Feb 03, 2011 8:40 am

Hi Marcio -

In your post, you say "5 sends later" - I assume you mean "5 seconds later". Is that correct?

I've created an example config that hopefully demonstrates what you're looking for. The state machine receives an event from the button and goes to the first state which sets the variable to 1 and kicks off a one shot timer. The timer is attached to the transition from the second state to the third state, so when the timer expires, this transition occurs. The third state clears the variable and sends and event to force it back to the first state.
Marcio.zip
(2.56 MiB) Downloaded 84 times
I hope this helps
john p.