LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Decrementing a variable repeatedly while it's inside a while loop

Solved!
Go to solution

Hello! I've written a program in which I can dynamically change the amplitude of the sum of waves. My problem now is that I want to be able to press the stop button and have the variable 'amplitude' decrement to less than .01 and then stop the run. My problem right now is that I need the amplitude variable to be inside the while loop in order to make it dynamically change the amplitude of the waves, but when I press the stop button the variable only decrements once, then remembers it's value from before that decrement and gets caught in an infinite loop. I've tried many things to solve this problem like shift registers and different kind of case and event structures to solve this. Can anyone help me out? Attached is my VI.

0 Kudos
Message 1 of 2
(853 Views)
Solution
Accepted by topic author RazorF

@RazorF wrote:

My problem now is that I want to be able to press the stop button and have the variable 'amplitude' decrement to less than .01 and then stop the run.


That's a control. LabVIEW does not really have "variables". Place the value in a shift register and keep decrementing until the desired stop condition is reached. (As a cheap hack, you could even write the decremented value to a local variable of the amplitude control, but then you need to set it again before the next run.)

 

  • Does the lower loop need to keep running during the decrementing?
  • What should happen if the user clicks the button off again while it is decrementing? 
  • so. many. questions.
Message 2 of 2
(818 Views)