Programming Limit switches in VCS

I’m not very familiar with programming limit switches in VCS using C+. I wiould like to code both states of a limit switch. The only way I have been successful is by coding the “On” state:


This code only activates when the switch is pressed. I follow the code up with a
“else” Statement.

What I would like to do is have a statement that for when it is off, like:

How do you code this?

You want the “logical negation operator”: !.

!Autonswitch.pressing() will evaluate to true when the switch is not pressed, and false when the switch is pressed.

1 Like

Awesome. I will have my team give that a try. Thank you!!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.