-
利用51超声波测距技术的避障小车
资源介绍
#include
#include
#define uint unsigned int
#define uchar unsigned char
sbit trig=P1^2; //超声波测距模块Trig
sbit echo=P1^1; //超声波测距模块Echo
sbit trig2=P1^3; //超声波测距模块2Trig
sbit echo2=P1^4; //超声波测距模块2Echo
sbit in1=P2^1;
sbit in2=P2^2;
sbit in3=P2^3;
sbit in4=P2^4;
bit flag1; //触发信号标志位//
uint M,K,L,S;
sfr WDT_CONTR=0xe1;
uchar num;
uchar count; //中断累加变量
long int distance; //测量所得距离
long int distance2