LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculator compute button

I am working on a volume calculator for the liquid inside of a cylindrical tank given the radius, length, and depth of the liquid inside. I have my VI working and accurate using a while loop with a case structure on the inside because the volume has to be calculated differently when the tank is more than half full than it is if it is less than half full. Anyway, for this assignment our instructor wants us to use a "Compute" button. This button should make the VI compute the resulting volume only when pressed. I have searched these forums and elsewhere but I can't find an example of what I need. I don't know what to use to control it. The while loop should only do 1 iteration the way I have it set up, but it immediately does that iteration instead of waiting on a button press like I want it to.

 

Basically I want the while loop to wait until I press a "Compute" button then run and spit out its information, and then stop and wait until I press the "Compute" button again. Basically think of it as the Equals button on a calculator.

0 Kudos
Message 1 of 3
(3,108 Views)

Hint: Have a look at the event structure. 😉

Message 2 of 3
(3,105 Views)

You have two options.

    The preferred and best way is to use an event structure.  In my opinion this is the best method by far.
    If you are uncomfortable with that method you could use a boolean with latch settings and put that into a case structure.   

Message 3 of 3
(3,063 Views)