Limit Switch Issues

Hello there,

So I have got the limit switch on my linear lift to stop it descending to far and snapping the chain… So what I have done is created the code so that if the limit switch is equal to 1 motors 6,7,8,9 (motors which are hooked up to the lift) stop… However when this actually happens, I am unable to drive or make the lift go up afterwards, it just seems to completely stop working !

Is there a variable block which I can put at the end of if statement to stop this from happening? btw I am trying to get this to work in operator control…


Please post your code.

I have attached an image…


Your program is getting stuck in the if statement and never exits. The program needs to continuously check the status of the limit in the while loop. The example below will work if the arm presses the limit switch then releases. If the switch is pressed and held down by the arm you’ll need to add more code to the IF statement moving the motors in reverse until the button is not pressed. Keep in mind that I used assumed motor ports, Digital I/O and joystick buttons. Use the same commands but revise the ports for your config.

See sample below.

Good Luck
Vex forum.JPG

Right now I understand, thanks for your help !!!

Excellent! Good luck with your programming.

Hello there,

I have just tried this code on my robot and what happens is, when I make the lift go up it juggers which it wasn’t doing before… Also when I press the limit switch, it doesn’t stop the lift from stopping…