#includeVarSpeedServo servoLeft1;//define left servo motor VarSpeedServo servoRight1;//define right servo motor double i=0; double j=0; int inputL = A0;//CNY70 Output as an input to Arduino我用了三个红外传感器循迹黑白线 int inputM = A1;//CNY70 Output as an input to Arduino int inputR = A2;//CNY70 Output as an input to Arduino int outputL = 8;//Pin8 be output connect Left LED在这定义了三个输出,外接小灯泡当车辆转向灯 int outputM = 9;//Pin9 be output connect Middle LED int outputR = 10;//Pin10 be output connect Right LED int L = 5;//Left infrared sensor if 5(0) means meet black line检测左白线 int M = 5;//Middle infrared sensor if 5(0) means meet black line检测中黑线 int R = 5;//Right infrared sensor if 5(0) means meet black line检测右白线 void servoStop();//这些是子函数,这是停车 void servoBack();//后退 void servoGo();//前进 void servoLeft();//左转 void servoRight();//右转 void servoGo1cycle();//前进一圈(精确控制) void servoBack1cycle();//后退一圈(精确控制) void setup() { // put your setup code here, to run once: Serial.begin(9600);//9600波特率 //Take the two wheels in front