// lr_servo.attach(lr_servopin); // connect servo
if (lr_angle < 0) { //limit the rotation angle of the servo
lr_angle = 0;
}
lr_servo.write(lr_angle); //output the angle of the servooutput
the angle of servo
delay(m_speed);
}
else if (abs(L - R) > error && L < R) { //Determine whether the error is
within the acceptable range, otherwise adjust the steering gear
lr_angle += resolution;//increase the angle
// lr_servo.attach(lr_servopin); // connect servo
if (lr_angle > 180) { //limit the rotation angle of servo
lr_angle = 180;
}
lr_servo.write(lr_angle); //output the angle of servo
delay(m_speed);
}
else if (abs(L - R) <= error) { //Determine whether the error is within
the acceptable range, otherwise adjust the steering gear