LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Button: with latch

Hello everyone,

I want to run devices with common Boolean Buttons. While pressed the device should run. When i release the button the device should stop. --> latch when release

I can not compile my VI if my buttons are with latch, or with "run while pressed". I think this problem is pretty common, but i can not figure out the solution.

I work with local variables, they seem to be the problem, since LabView says boolean buttons with latch combined with local variables, cant be compiled I also tried to use property nodes and worked with values. But i cant find the solution.

Anyone with a workaround or a solution here?

0 Kudos
Message 1 of 3
(885 Views)

You are correct that buttons with latch behaviour are incompatible with local variables, this is by design.

 

You don't show your program, so I'm just guessing here. But just use switch when pressed instead. When the measurement is done, set the button back to false using a local variable.

 

Btw, people will inevitibly come here to tell you that local variables are terrible and you should use a state machine or producer/consumer architecture. I agree, but I'll also say that for simple (non-production) programs or beginner level programs, just use what works, you'll figure out better ways soon enough.

0 Kudos
Message 2 of 3
(876 Views)

@bulnomali wrote:

Hello everyone,

I want to run devices with common Boolean Buttons. While pressed the device should run. When i release the button the device should stop. --> latch when release


What you describe, "True while pressed, False when released" is a "Push-Button", also called "Switch when released".  Did you know that all the Boolean controls have an associated "Mechanical Action" that governs when and how they switch?  By design, the "rectangular" buttons (like "Stop") are "Latch when Released", which means they "stay pressed" until you read them (and determine if they are pressed = True or not = False, at which point they return to their default value).

 

Bob Schor

0 Kudos
Message 3 of 3
(845 Views)