08-29-2016 09:00 AM
Hello,
So I have a double that is counting down from 200 seconds (my own timer, not any built-in timer). I can pause the time in the middle of running the program. I want to check to see if that double is still counting down (running) and if not (paused), do some additional stuff like turn on a light saying timer is paused, etc. How can I check to see of the timer is counting down or not?
Thanks for any help!
SM
Solved! Go to Solution.
08-29-2016 09:02 AM
Sounds like you want an event structure with a value change on the timer beign false triggering your actions.
08-29-2016 09:09 AM
The problem with an Event Loop is that it only "fires" when there is an Event. You can trigger a "Timer Changed" Event, but it is another thing to say "This did not happen".
A simpler way to do this is to store the Boolean value of "Is Timer Running?" somewhere. Several ways suggest themselves (depending on the design of your code). The simplest, useful particularly if you are using a State Machine or something with a single loop surrounding Case Statements that "do various things under various conditions" is to save the Boolean in a Shift Register. On the other hand, if you have multiple loops, or use lots of sub-VIs, you might consider using a Set/Get VIG that "remembers" the status of the Timer.
Bob Schor
08-29-2016 09:15 AM
Bob,
Thanks for the reply. That's just my issue, how do I "store the Boolean value of "Is Timer Running?" somewhere"? I can do the other stuff based off the boolean, but I'm not sure how to check the state of a double to see if it's counting down or not?
Thanks for the help,
SM
08-29-2016 09:25 AM - edited 08-29-2016 09:27 AM
just re-writing this.
08-29-2016 09:30 AM
Thanks for the help guys!
SM
08-29-2016 09:30 AM
@SteMob wrote:Bob,
Thanks for the reply. That's just my issue, how do I "store the Boolean value of "Is Timer Running?" somewhere"? I can do the other stuff based off the boolean, but I'm not sure how to check the state of a double to see if it's counting down or not?
Thanks for the help,SM
I don't understand. You don't need to check the state of the double to determine whether or not your timer is running. After all, it is *you* that is determining whether or not it's running in the first place! (Just set the Boolean when you start the timer.)
Unless, of course, this is homework and the assignment is to check to see if the double is changing or not. 😉