Thread: Default code??
View Single Post
  #1   Spotlight this post!  
Unread 02-02-2008, 14:32
jacobhurwitz jacobhurwitz is offline
Registered User
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Maryland
Posts: 45
jacobhurwitz has a spectacular aura aboutjacobhurwitz has a spectacular aura aboutjacobhurwitz has a spectacular aura about
Re: Default code??

Quote:
Originally Posted by RRA4LIFE2 View Post
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.