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: 

Change state of boolean button

Solved!
Go to solution

Hello again, you marvellous people!

 

I have what I hope is a simple question. I'm not including the VI because it's not really relevant (I think).

 

I have a boolean button controlling an LED, but I want a secondary control that, if I press it, changes the state of the boolean, irrelevant of which state it's in at the time (i.e. if it's off, turn it on, if it's on, turn it off). Kind of like a "Not" gate, but without an input.

 

This seems like it should be a simple thing but I cannot for the life of me figure out how to do it.

0 Kudos
Message 1 of 6
(3,450 Views)

You want the NOT function on the boolean palette and apply it to its current value.

0 Kudos
Message 2 of 6
(3,441 Views)

If you XOR the two controls you will get what you need.

 

0xDEAD

0 Kudos
Message 3 of 6
(3,412 Views)

@kathmonkey wrote:

Hello again, you marvellous people!

 

I have what I hope is a simple question. I'm not including the VI because it's not really relevant (I think).

 

I have a boolean button controlling an LED, but I want a secondary control that, if I press it, changes the state of the boolean, irrelevant of which state it's in at the time (i.e. if it's off, turn it on, if it's on, turn it off). Kind of like a "Not" gate, but without an input.

 

This seems like it should be a simple thing but I cannot for the life of me figure out how to do it.


Your statement is ambiguous; specifically, which boolean are you referring to here: "changes the state of the boolean"?  The button or the LED?  I'm going to guess that you mean the button.  If the button has a mechanical latching action, you can't* change it programmatically.  If it's a non-latching button, you can write to it using a local variable, or a Value property node (but you may actually need to use the Value Signalling property).

 

* Well, OK, there is a way to do it, but you shouldn't.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 4 of 6
(3,403 Views)
Solution
Accepted by topic author kathmonkey

P- node...read value, NOT value, set value.  Now, let's talk about the boolean button.  Is it a control or an indicator? What is it's mechanical Action ( I hope it is a switcher not a latcher)

 

We will get you straight yet!


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 6
(3,387 Views)

Thank you everyone for your input. I ended up scrapping the whole system and starting from scratch from a different direction. Your suggestions were all excellent though, thank you!

Message 6 of 6
(3,367 Views)