LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing a switch to default when disabled

Hello,

 

I have a toggle switch that I sometimes disable (grey out and disabled) when a user shouldn't be able to use the switch. However, I'm looking to return the toggle switch to a default position when it is disabled such that when I enable the toggle switch it isn't in the last state the user left it in.

 

Scenario: A toggle switch to turn on a motor. The user turns on the motor via the toggle switch. The user enters a new operating mode where this motor can't be run so the toggle switch is disabled and greyed out to prevent the user from accidently turning on this motor. The user enters the first operating mode, since the user last left the toggle switch in the on position it will still be in the on position and the motor turns on. I don't want this to happen as the user might not want to have the motor turned on when re-enetering the first operating mode.

 

Thank you.

 

P.s. If my explenation is difficult to follow, please post and I will try to clarify my intent

0 Kudos
Message 1 of 9
(3,789 Views)
Can you change the mechanical action to "latch when released" and try your logic? Remember if you are using local variable/property node you may find error while doing this. Just check whether it helps.
-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 9
(3,785 Views)

You can use a property node to enable the button back in your final state ( assuming you are using a statemachine model). 

0 Kudos
Message 3 of 9
(3,782 Views)

I recommend with the same property node which you are using to disable it to also set the value property to FALSE.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 9
(3,778 Views)

Crossrulz - I am not sure if I'm implementing your suggestion correctly. But if I wire a 'False' logic to the 'Value' property than the toggle switch will always return to false no matter if the switch is enabled or disabled. Unlike your example, I have logic going into my 'Disabled' property node which will select either 'disabled and grayed out' or 'enabled' depending which operating mode the user is in.

 

 

0 Kudos
Message 5 of 9
(3,765 Views)

P@Anand - I am trying to not have the toggle switch behave like a momentary start button. I want it to stay in the 'Motor On' position when someone toggles it and visa versa. Thank you for the suggestion though.

0 Kudos
Message 6 of 9
(3,761 Views)

@DougHallman wrote:

Crossrulz - I am not sure if I'm implementing your suggestion correctly. But if I wire a 'False' logic to the 'Value' property than the toggle switch will always return to false no matter if the switch is enabled or disabled. Unlike your example, I have logic going into my 'Disabled' property node which will select either 'disabled and grayed out' or 'enabled' depending which operating mode the user is in.


In that case, I would use a Case Structure based on the Disable property value that is being set.  If set to Disable and Gray Out, set the value with a local variable.  Default to do nothing.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 9
(3,750 Views)
So the user toggles the switch to ON and the motor starts running. Will the motor be turned off when the user enters the new operating mode? Or you want to stop the motor when entering the new mode?
-----

The best solution is the one you find it by yourself
0 Kudos
Message 8 of 9
(3,749 Views)

In that case, I would use a Case Structure based on the Disable property value that is being set. If set to Disable and Gray Out, set the value with a local variable. Default to do nothing.


 

Also you can have a case where you use an invoke node to "reinitialize it to default".

0 Kudos
Message 9 of 9
(3,712 Views)