Quote:
Originally Posted by RRA4LIFE2
We are a rookie team, team 2595. We want to use the default code that we got but don't know if it'll work. We are running a 2 motor drive and the default code is a 4 motor drive???
How do we change the default code to work for teleoperated for a 2 motor drive?
|
With MPLAB, the following should work for tank drive:
Code:
pwm01 = pwm02 = p1_y;
pwm03 = pwm04 = p2_y;
This assumes pwms 1 and 2 are the left wheels and port 1 is the left joystick; pwms 3 and 4 are the right wheels, and port 2 is the right joystick.
When both joysticks are forwards, all motors are forward and the robot goes forward. When both are back, the robot goes backwards. When one joystick is forward and one is backwards, the left and right motors move in opposite directions and the robot twists clockwise or counterclockwise.