# Slowing down Camera drive turning

How can I make it turn at a slower speed when tracking with the following code…

if (p1_sw_trig > 0 && tracking > 0) { //If vision active and tracking use camera data
p1_y = speed_control; //set forward speed
p1_x = pan_position; //set turning rate
p1_x = 255 - p1_x; //invert turn direction
// Steering Compensation
if (p1_x > 135 && p1_x < 225 && steering_comp > 0)
p1_x = p1_x + steering_comp;
if (p1_x < 120 && p1_x > steering_comp && steering_comp > 0)
p1_x = p1_x - steering_comp;
pwm11 = Limit_Mix(2000 + p1_y + p1_x - 127); //uses our ramp
pwm12 = Limit_Mix(2000 + p1_y - p1_x + 127); //uses our ramp

At top of file:

``````unsigned char slow_down = 10; // Change based on how slow you want
``````

On the line before pwm11 = …:

``````if (p1_x > 127 && p1_x - slow_down > 127)
p1_x -= slow_down;
else if (p1_x < 127 && p1_x + slow_down < 127)
p1_x += slow_down;
``````

This will decrease the speed by slow_down. You could also limit the maximum turning rate. Ex: if p1_x > 140 then p1_x = 140