//*********************************************************
//電機編碼器計算
//*********************************************************
void Position_Calculate(void)
{
speed_r_l =(speed_mr + speed_ml) * 0.5;
car_speed *= 0.7; //車輪速度濾波
car_speed += speed_r_l * 0.3;
car_position += car_speed; //積分而得到位移
car_position += speed_need;
Serial.print("sp=\t");
Serial.print(speed_mr);
Serial.print("\t");
Serial.print(speed_ml);
Serial.print("\t");
Serial.print(car_speed);
Serial.print("\t");
Serial.println(car_position);
。。。
xxxxx
}