Quote:
Originally Posted by rwood359
Does the operation work if the arm is moving very slowly? Remember that the limit switch is only being tested once for each execution of the loop. If the limit switch is only set for a small period, it is possible for the switch to be set and then rotate past to the point that it is not set between executions of the loop. When you are using a limit switch, you will find that the ending position will not be exactly the same each time that the limit is reached. The speed of the arm and repetition rate of the loop cause some uncertainty.
|
Excellent point. I set up our code so that there is a dedicated, 10ms loop that just checks the limit switch and stops the motor.
However, that's probably not the real problem.
What did you check to make sure the limit switch worked? If it was somewhere within teleop (with a probe or an indicator or something), then it's probably just how you stopped the motor. If it was that your heard a clicky sound or used a multimeter, it could be anything.
EDIT: I just looked at the program, and it seems as if you will stop the actuator if either switch is pressed. If you have one at the top of the reach and one at the bottom, this is not what you want. I'll attach what we did for limit switches.