Serial.print(" D ");
Serial.print(D);
Serial.print(" ud_angle ");
Serial.print(ud_angle);
Serial.print(" lr_angle ");
Serial.println(lr_angle);*/
// delay(1000);//During the test, the serial port data is received too
fast, and it can be adjusted by adding delay time */
}
/**********the function of the servo************/
void ServoAction(){
int L = analogRead(l_state);//read the analog voltage value of the
sensor, 0-1023
int R = analogRead(r_state);
int U = analogRead(u_state);
int D = analogRead(d_state);
/***************system adjusting left and right**********************/
// abs() is the absolute value function
if (abs(L - R) > error && L > R) { //Determine whether the error is
within the acceptable range, otherwise adjust the steering gear
lr_angle -= resolution;//reduce the angle