Here's the acceleration code we use to make sure the drivers aren't crunching gears... Use it ONLY if you learn something from it. Take a look and figure out how it works...
Code:
SAFE_ZONE CON 1000
MAX_ACC CON 10
MAX_ACC_VAL CON SAFE_ZONE + MAX_ACC
MIN_ACC_VAL CON SAFE_ZONE - MAX_ACC
left_motor:
if (abs(left_control - 127) > DEAD_ZONE) then left_calc
left_control = MOTOR_OFF
left_calc:
speed_l = speed_l + (((left_control - speed_l + SAFE_ZONE) min MIN_ACC_VAL max MAX_ACC_VAL) - SAFE_ZONE)
right_motor:
if (abs(right_control - 127) > DEAD_ZONE) then right_calc
right_control = MOTOR_OFF
right_calc:
speed_r = speed_r + (((right_control - speed_r + SAFE_ZONE) min MIN_ACC_VAL max MAX_ACC_VAL) - SAFE_ZONE)