View Single Post
  #2   Spotlight this post!  
Unread 16-02-2008, 22:41
cmptrgy412 cmptrgy412 is offline
Robohawks Programmer
AKA: Jacob G
FRC #1985 (Robohawks)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Missouri
Posts: 7
cmptrgy412 is an unknown quantity at this point
Re: One joystink drive

Sure. What you should end up having is code that looks like this:

Code:
// on our joystick the x values were inverted
int nTurn = ramping(128 - p1_x) + 127;
int nSpeed = ramping(p1_y - 127) + 127;

int left =  (int)Limit_Mix(2000 + nSpeed + nTurn - 127);
int right = (int)Limit_Mix(2000 + nSpeed - nTurn + 127);

// pwm01/pwm02 corresponds to motor PWMs.
pwm01 = left;
pwm02 = 255 - right;
The nTurn and nSpeed will be adjusted based off your ramping.
the left and right values go through a typical 1-joystick function.

Then you just assign those values to your motors.
__________________