EasyManua.ls Logo

Eckstein komponente KS0530 - Page 152

Default Icon
160 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
152
// 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