在淘寶購買的尋跡模塊+自己做的小車底盤 測(cè)試成功#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接四路尋跡模塊接口第一路輸出信號(hào)即中控板上面標(biāo)記為OUT1#define Right_1_led P3_3 //P3_3接四路尋跡模塊接口第二路輸出信號(hào)即中控板上面標(biāo)記為OUT2 #define Left_2_led P3_4 //P3_4接四路尋跡模塊接口第三路輸出信號(hào)即中控板上面標(biāo)記為OUT3#define Right_2_led P3_5 //P3_5接四路尋跡模塊接口第四路輸出信號(hào)即中控板上面標(biāo)記為OUT4#define Left_moto_go {P1_0=1,P1_1=0,P1_2=1,P1_3=0;} //左邊兩個(gè)電機(jī)向后轉(zhuǎn)#define Left_moto_back {P1_0=0,P1_1=1,P1_2=0,P1_3=1;} //左邊兩個(gè)電機(jī)向前走#define Left_moto_Stop {P1_0=0,P1_1=0,P1_2=0,P1_3=0;} //左邊兩個(gè)電機(jī)停轉(zhuǎn) #define Right_moto_go {P1_4=1,P1_5=0,P1_6=1,P1_7=0;} //右邊兩個(gè)電機(jī)向前走#define Right_moto_back {P1_4=0,P1_5=1,P1_6=0,P1_7=1;} //右邊兩個(gè)電機(jī)向前走#define Right_moto_Stop {P1_4=0,P1_5=0,P1_6=0,P1_7=0;} //右邊兩個(gè)電機(jī)停轉(zhuǎn) /*********************************延時(shí)函數(shù) ***************************************/ void delay(uint k){ uint x,y;for(x=0;x
評(píng)論