在淘宝购买的寻迹模块+自己做的小车底盘 测验成功
#includesbit P1_0 = P1^0;sbit P1_1 = P1^1;sbit P1_2 = P1^2;sbit P1_3 = P1^3;sbit P1_4 = P1^4;sbit P1_5 = P1^5;sbit P1_6 = P1^6;sbit P1_7 = P1^7;sbit P2_0 = P2^0;sbit P2_1 = P2^1;sbit P2_2 = P2^2;sbit P2_3 = P2^3;sbit P2_4 = P2^4;sbit P2_5 = P2^5;sbit P2_6 = P2^6;sbit P2_7 = P2^7;sbit P3_2 = P3^2;sbit P3_3 = P3^3;sbit P3_4 = P3^4;sbit P3_5 = P3^5;sbit P3_6 = P3^6;sbit P3_7 = P3^7;#define uchar unsigned char#define uint unsigned int#define Left_1_led P3_2 //P3_2接四路寻迹模块接口榜首路输出信号即中控板上面标记为OUT1#define Right_1_led P3_3 //P3_3接四路寻迹模块接口第二路输出信号即中控板上面标记为OUT2 #define Left_2_led P3_4 //P3_4接四路寻迹模块接口第三路输出信号即中控板上面标记为OUT3#define Right_2_led P3_5 //P3_5接四路寻迹模块接口第四路输出信号即中控板上面标记为OUT4#define Left_moto_go {P1_0=1,P1_1=0,P1_2=1,P1_3=0;} //左面两个电机向后转#define Left_moto_back {P1_0=0,P1_1=1,P1_2=0,P1_3=1;} //左面两个电机向前走#define Left_moto_Stop {P1_0=0,P1_1=0,P1_2=0,P1_3=0;} //左面两个电机停转 #define Right_moto_go {P1_4=1,P1_5=0,P1_6=1,P1_7=0;} //右边两个电机向前走#define Right_moto_back {P1_4=0,P1_5=1,P1_6=0,P1_7=1;} //右边两个电机向前走#define Right_moto_Stop {P1_4=0,P1_5=0,P1_6=0,P1_7=0;} //右边两个电机停转 /*********************************延时函数 ***************************************/ void delay(uint k){ uint x,y;for(x=0;x