09-24-2020 04:32 PM - edited 09-24-2020 04:44 PM
@Armagedon wrote:
Please, enlighten me how I can iteratively count up from 0 to 4 and count down from 4 to 0 with 0.1 sec delay.
state will cycle from 0, 1 ... , 4, 3 , .., 0, 1 ...
09-25-2020 04:46 AM
you can also do a "rectified" triangle wave like this:
and then auto-index a For Loop...
09-25-2020 05:11 AM
@Armagedon wrote:
Likewise, I will try to change it as it would go to 0 after reaching 4 and then start counting until 4 again.
From this remark I get the feeling OP wants to go 0,1,2,3,4,0,1,2,3,4 AND\OR 4,3,2,1,0,4,3,2,1,0, not 01,2,3,4,3,2,1.
The title implies there is a 4-0 count down, but that could be in parallel of the up counting.
Of course, if you can count up from n=0-4, counting down is simply 4-n...
09-25-2020 08:41 AM
OMG. You are so exactly on the point. Yes, I made mistake while writing the title.
What I am looking for was 0,1,2,3,4,0,1,2,3,4,0 and so on.
09-25-2020 08:55 AM
Here is another way to do it (delay set to 1 s so you can see it counting).
09-25-2020 09:19 AM
Yes, it can be quite simple.
But none of the simple solutions will fit into an existing application, working as a simulation for a real device.
And we can't really suggest a solution for that, as it will depend on the existing structure...
If you have some driver VI that gets called in a loop, you'd could do something like this:
This can be called as often as you like, but should be called significantly more often then 5 times per second for good results.
09-25-2020 09:21 AM
Just for fun.