LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exit while loop if button that activates it is On after X seconds

Hi guys, I'm trying to make some kind of virtual drums in labview and I want to be able to press a button and play a wav file but if the button is pressed again after n secondsI want the file to be reseted and played from the begining, How can I achieve this?
The while loop that should be exited is the one that says "Read Sound File and Generate Sound", this is based out of a file from the examples. Also the wav files are selected from a directory before I start the VI.

Thanks in advanced.

Edit: Fixed a bug with Vi.

Download All
0 Kudos
Message 1 of 3
(2,382 Views)
  • If you chose the file before you start the VI, all the reading and setup belongs before the loop. No need to redo that with every press of the button.
  • What is the purpose of the upper loop, just starve everything else for CPU uslage?
  • What is the purpose of "build path" with the upper input not even used?
Message 2 of 3
(2,365 Views)

I made the file directory available to be updated because I thought that If i needed to change the "song" while the program is running It'd make it easier.
The upper loop checks constantly for a change in a button (thanks for pointing that I see now that it has the same effect outside the while loop) in the end I want the actions to be activated depending on the values throught the COM port (e.g. the string 1001 plays the first and last wav file at the same time).
Also thanks for telling me the last part, I didn't know I could pass the control value directy to the next vi instead of using the build path.

0 Kudos
Message 3 of 3
(2,357 Views)