LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I turn on and off this vi using one button?

Hello,

I am pretty new in using LabVIEW and trying to learn a few things by myself.

I found this example "generate sound" on my hard disk (attached) and would like to make some changes according to the need.

Here in the program, the loop is terminated by pressing the stop buttom.

I want to add a button, lets say turn on button to start running this code and when I press the same button, it should terminate (instead of stop button).

 

Please help me in this regard. I will be very thankful.

 

Regards,

0 Kudos
Message 1 of 4
(2,380 Views)

Right click on a button (front panel) and go to mechanical action, choose switch when pressed (or released).  This way, the button will default to False.  When you press it, it will be true (wire this to a case statement to start your desired code).  Then, monitoring the button state using a local variable, have your code set up to terminate when the button is changed back to the false case.

0 Kudos
Message 2 of 4
(2,378 Views)

Thanks.

The first part, I was able to follow.

Can you please show me on the atached file what you meant by "Then, monitoring the button state using a local variable, have your code set up to terminate when the button is changed back to the false case."?

 

 

0 Kudos
Message 3 of 4
(2,367 Views)

not quit sure what you mean by terminate (leave no memory)?

Example_VI.png

0 Kudos
Message 4 of 4
(2,341 Views)