01-15-2024 10:18 AM
Hello all,
How could I create an array of timers which I can deal with every timer inside this array individually? For EX. (I need just to reset the timer in the second element of the array and keep the other elements running) I hope my idea is clear and am looking for help.
Thanks in advance
Solved! Go to Solution.
01-15-2024 10:49 AM
Hi Mina, I think many people create some re-usable timer code because it is needed so often. I've made a Timer class (attached). You can simply create as many instances as you need.
You could build them into an array, but you will have to document the code very well so that everyone knows what the second element of the timer array actually corresponds to. Depending on your application, a cluster may be better so that each timer can have a name specified.
01-15-2024 01:41 PM
@Mina55 wrote:
How could I create an array of timers which I can deal with every timer inside this array individually? For EX. (I need just to reset the timer in the second element of the array and keep the other elements running) I hope my idea is clear and am looking for help.
No, it is not clear at all.
Where is "this array" and what does it represent? What are the various operations on each timer besides "reset" (e.g. start, stop, pause). How does the front panel look like? What is the purpose of the timers?
01-15-2024 02:01 PM - edited 01-15-2024 02:11 PM
01-15-2024 02:28 PM
Thanks it helped
01-15-2024 02:33 PM
My question was too simple I just wanted to have an array of timers that I could reset (Just reset) any one of them individually depending on a certain action if it got triggered or not (true or false) not with a push button and this is a part of a big code
01-15-2024 02:37 PM
@Mina55 wrote:
My question was too simple I just wanted to have an array of timers that I could reset (Just reset) any one of them individually depending on a certain action if it got triggered or not (true or false) not with a push button and this is a part of a big code
Fortunately, LabVIEW logic does not care at all where a boolean comes from (front panel control, result of some operations, digital input, etc.). As long as the "dataflow" is right, things will work the same.
01-15-2024 02:45 PM - edited 01-15-2024 02:46 PM
Yes it gave me some insight into what should I do further some minimal things that I could do on top of your work that I will make the timer value as an input and once the elapsed time gets equal to the timer value it should auto-reset
Thanks a lot for giving me the main idea👌