Quote:
Originally Posted by Tub Tubs
I wanted a motor to push a metal bar out of the robot to block other robots
|
Then why not do yourself a favor and let the hardware do most (if not all) the work for you. In your code (the software side), all you need is to watch the value of a trigger on your joystick (or another button of your choice); once pressed, just tell your motor to "go" - don't worry about telling it to stop, let the hardware handle that for you. On the hardware side, use limit switches plugged into the Jags as stops on your bar; if done correctly, the limit switches will be normally-closed while the Bar is on your robot, and they will be open once your bar extends as far out as it needs to be. The open limit switch will cause the Jag to brake (not "break") the motor, acting as your stop.
There ya go, an incredibly simple mechanism to code and set up.
-Danny