From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
what is the most effective way to alternate between two or more states in a state machine based on time. I would like to record data in one state , after 5 minutes log the data and after 10hrs or so run a pump, valve , etc.
If i am correct that works if you have two states. How about when you have multiple states that have to execute at different times without conflict using the same timer.
You can still use the Elapsed Time. Just set the Auto Reset to false. Compare the elapsed time to see if it's a multiple of your required time for that specific state. For example, for the "log" event, see if the elapsed time is at least a multiple of 5 minutes. Instead of the Elapsed Time you could also just use the Tick Count. The difference is that with the Elapsed Time you'll get seconds as a float, whereas with the Tick Count you'll get msec as an integer.