文档介绍:
#include #defineECHOP2_4 //超声波接口定义 #RIGP3_0 //超声波接口定义#defineSevro_moto_pwmP2_7 //接舵机信号端输入PWM信号调节速度 #defineLeft_1_ledP3_4 //P3_4接四路寻迹模块接口第一路输出信号即中控板上面标记为OUT1 #defineLeft_2_ledP3_5 //P3_5接四路寻迹模块接口第二路输出信号即中控板上面标记为OUT2 #defineRight_1_ledP3_6 //P3_6接四路寻迹模块接口第三路输出信号即中控板上面标记为OUT3 #defineRight_2_ledP3_7 //P3_7接四路寻迹模块接口第四路输出信号即中控板上面标记为OUT4 #defineLeft_moto_pwm P1_1 //PWM信号端 #defineLeft_moto_pwm1 P1_3 #defineRight_moto_pwm P1_5 #defineRight_moto_pwm1 P1_7 #defineLeft_moto_go{P1_4=1,P1_6=1;}//左边两个电机向前走 #defineLeft_moto_Stop{P1_4=0,P1_6=0;}//左边两个电机停转#defineRight_moto_go{P1_0=1,P1_2=1;} //右边两个电机向前走 #defineRight_moto_Stop{P1_0=0,P1_2=0;} //右边两个电机停转 unsignedcharconstdiscode[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90/*-*/}; unsignedcharconstpositon[4]={0xfe,0xfd,0xfb,0xf7}; unsignedchardisbuffcj[5]={0};//显示缓存unsignedcharposit=1;//定义扫描数码管字数 unsignedchardisbuffcs[5]={0}; //显示缓存 unsignedchari=1; //定义扫描数码管字数 unsignedintcount1=0; //计左电机码盘脉冲值 unsignedintV=0; //定义其速度unsignedchardisbuffwy[5]={0};//显示缓存unsignedcharj=1; //定义扫描数码管字数 unsignedintcountsum=0;unsignedintX=0; //定义其位移unsignedcharpwm_val_left=0;//变量定义 unsignedcharpush_val_left=0;//左电机占空比N/10 unsignedcharpwm_val_right=0; unsignedcharpush_val_right=0;//右电机占空比N/10 unsignedcharpwm_val=0;//变量定义 unsignedcharpush_val=14;//舵机归中,产生约,1.5MS信号 unsignedinttimecj=0;unsignedinttimecs=0;unsignedlongS=0; unsignedlongS1=0; unsignedlongS2=0; u
内容来自淘豆网www.taodocs.com转载请标明出处.