|
Re: coding for limit switch
Instead of forcing the motor to run for "a while" when a limit switch is tripped, you can just use the switch to keep the motor from going any further in the wrong direction. Don't worry about moving it away, just worry about keeping it from going past the limit.
The typical way to do this is to splice into the speed control value. Set it to zero if one limit switch is active and the incoming value is positive, or if the other switch is active and the value is negative. This will stop the motor as it drives into the limit, and you can rely on other signals to drive the motor back.
|