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.
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.
04-27-2012 03:10 PM
I am using a boolean control with the mechanical action set to switch until released, I want the button to go back to the original state.
I am using it in an event structure set to trigger on a value change. The action of pushing the button is generating two events, one of the on state and one for when it returns to the off state.
How do I control this so that only one event is triggered and the second event that is queued up is ignored, I would like the button to go back to the original state and not execute code twice.
Thanks
Jim
Solved! Go to Solution.
04-27-2012 03:19 PM
You can use the value from OldVal or NewVal in the event case and a conditional structure to mask it off. Do you really need switch until released functionality? That's intended to give you two events, as the click and release are different actions. Switch when released might be a better fit for you if you only want one event.
04-27-2012 03:24 PM
Use Latch When Released.
04-27-2012 03:29 PM
Switch when released does not switch the button back after it have been read.
I prefer Latch when released - they switch back automatically when terminal is read AND (not but) they do not allow local variables.
04-27-2012 03:34 PM
Right, I should have said latch. Be sure to put the button control somewhere it'll be read to reset the latch. It doesn't need to be wired to anything, just read. Sitting inside the event case is fine if you're not using it anywhere else.
04-27-2012 03:42 PM
That solved it for me, thanks for the speedy response
Jim