How To Use Limit Switches

Hello.
I have created a 6 bar robot. I have limit switches in place to prevent it from going too low/too high and grinding gears. How would I program those switches in Easy C V4 so that the system works in driver mode? Please reply if you know, state competition is tomorrow.:slight_smile:

I don’t use easyC so I can’t help.

But for future reference, asking for help at 7 p.m. Friday night and wanting help before a Saturday competition is probably not going to yield you the results you desire.

It all depends on how you have programmed the lift so far. One way is to use the blocks “JoystickToMotorAndLimit” or “JoystickDigitalToMotorAndLimit”. If you have code that sends values to the motors using SetMotor then the general idea is that when going forwards and you trip that limit switch then only allow negative control values. Same for the other direction, motor going negative and you trip the switch then only allow forward value.

you could also use if and if else statements to create the same effect. for example you would create a joystick to digital, then you would have and if statement saying if that button equals to 1, then turn on the motors, the you would add if else statements saying that if your limit switches are equal to 1, then set motor power to 0. thats what i would do