From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean doesn't change value

Good evening everyone,

 

For a project, I have to simulate a synthesizer with a MyDAQ card. I want a sound to come out when I plug a digital input into 5V and it will stop when I unplug it.

 

I realized the attached program. When I plug in the wire, the boolean becomes "'True" and the beep starts. Except that the boolean does not resume the value "False" when I unplug the wire which means that the sound signal continues as long as I do not stop the defined program.

 

This only makes me for a sound signal, I tested with simple different calculations depending on the value of the boolean and for that, the program works very well! The boolean does indeed change value.

 

You will also find the joint program of my subVI which I use to generate the sound signal.

 

Thank you in advance for your answers

 

Good night

Download All
0 Kudos
Message 1 of 3
(728 Views)

Your problem is that your subVI that creates sound never stops. It continues to loop until it sees an error or the Stop button is pressed on its front panel.

 

You will need to either use queues/user events/notifiers/etc to communicate between the loops, or set it up so that a True writes a value to the Play Sound function once, then the program returns. Otherwise, the first time you detect a True, that program will begin executing continuously and will never stop.

0 Kudos
Message 2 of 3
(715 Views)

Hi Chamart,

 

Bert already told you the reason why your VIs don't behave as expected…

 

Another notes:

  • It doesn't make sense to compare a boolean value with "==TRUE". This is called a classic Rube-Goldberg!
  • Usually subVI icons look better with a closed border. In your mainVI some wires (seem to) end suddenly…
  • You did not attach  program. All you attached are images of some code: we cannot debug/edit such images using LabVIEW. Keep this in mind for your next "code attachments"…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 3
(652 Views)