LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure-execute just once

Hi
Basic question: If I wish the code in a case structure to execute just once upon the click of a boolean control how do I achieve this efficiently? At present I have been setting a local variable of the Boolean control to False from within the Case structure,.. and this seems to work but I think it is clumsy and I am sure there is a better way to do this!
Thanks,
Robert
0 Kudos
Message 1 of 5
(2,907 Views)
Simply change the mechanical behaviour of your boolean control (right click on the control -> "Mechanical action") and choose "latch when released".
Chilly Charly    (aka CC)
0 Kudos
Message 2 of 5
(2,907 Views)
Yes, this will work if there is no need to read the boolean in question elsewhere in the code.

Otherwise, the technique of setting to boolean false is valid.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 5
(2,907 Views)
Hi Ben !
I think that this would probably create a race condition. May be a Notifier could do it ?
Chilly Charly    (aka CC)
0 Kudos
Message 4 of 5
(2,907 Views)
"...to False from within the Case structure"

I read this as the case structure that is driven by the boolean. Data flow says boolean will be read first...

But maybe I mis-read.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 5
(2,907 Views)