09-28-2016 10:25 AM
The program below is used to control a step motor with NI 9401. However it has been designed to work in two ways, when you push the buttom "adelante" or "atras" it turn into one way or another, but if you push "Start" it begin to move in a particular way (that I have indicated) and if you push again the same buttom ("Start") it have to stop (in that way you can push the buttoms "adelante" or "atras" if you want). The problem that I have is with the "local variables", because when the "Start" buttom is unpushed I have three while-loop and I don´t know how to said it to stop when the "Start" buttom has been pushed and the same when the "Start" buttom is pushed, and i push the "Start" buttom to stop it. I have a mess with the function of local variables.
I know that is a little complicated to understand with word, i have tried to explain the most clearly. I hope that you can help me.
Solved! Go to Solution.
09-28-2016 10:45 AM
Lincoln,
i believe youre trying to stop parallel loops and youre having trouble using local variables. Take a look at this example attached. I think using a notifier should help you a lot.
You can use a second event loop outside of your main loop to control which notifier to send.
09-28-2016 10:45 AM
Why do you need 3 while loops?
What do you mean by "unpushed"? The start button is latch action which means it pops back up automatically once it is read. I think it would be confusing to users to have the same button do two different actions (start vs. stop) when the button appearance is the same. Why not use "Switch when released"?
09-28-2016 11:23 AM
Hello matt198717,
Yes, I think the problem was trying to used local variables in parallel loops. I use this time property node and it work!.