hello i ma a lead programmer from team 5709 the rudyard nerfherders and i was wondering how do i program limit switches to stop a motor from rotating a certain way when it is closed?
so if the elevator hits a limit switch on the bottom it will only be able to allowed to go up and not down anymore.
I can’t answer your question, but you will need to share the programming language you are using as well as weather you are using NC or NO for the limit switch. Once this info is provided someone on here should be able to help you.
i ma using java and i would like to know how to do it for them both
Hi,
The simple way to do this would be with an if statement:
double speed = getJoystickAxis();
if(limitswitch.get() && speed<0)
{
speed=0;
}
motor.set(speed);
That makes your motor output 0 instead of a negative value when your switch is pressed, but still allows it to have a positive value
This topic has been explained more in-depth in a previous post: http://www.chiefdelphi.com/forums/showthread.php?t=134642
You can probably find the best answer there.