|
Re: New Joysticks...Good or Bad Choice by FIRST?
The easiest way to do this would probably be to add a deadband in programming by changing the output value to the motor to 127 if the joystick is within a certain range of 127. For example, if pwm01 and pwm02 are controlling the robot drive, you could insert the following code in the Process_Data_From_Master_uP function in the user_routines.c function:
int deadband = 20;
//the above value may need to be more or less depending on how sensitive the joysticks are
pwm01 = (abs(pwm01 - 127) <= deadband ? 127 : pwm01);
pwm02 = (abs(pwm02 - 127) <= deadband ? 127 : pwm02);
and add this function to find absolute value to the user_routines.c file as well:
int abs(a) {
return (a < 0 ? -a : a);
}
I have not tested this, but I do believe that it should work.
__________________
5! * (4! - 3! - 1!) / 2!
|