求基于51单片机的超声波避障智能小车程序?避障的话,最好能用两个以上超声波模块,这样做就可以不用步进电机了。你可以把两到三个超声波模块按一定角度装到车的前部,这样就可以根据三个超声波模块回收的距离信息来判断哪个方向有障碍物,从而选择正确的方向前行
求基于51单片机的超声波避障智能小车程序?
避障的话,最好能用两个以上超声波模块,这样做就可以不用步进电机了。你可以把两到三个超声波模块《繁:塊》按一定《dìng》角度装到车的前部,这样就可以根据(拼音:jù)三个超声波模块回收的距离信息来判断哪个方向有障碍物,从而选择正确的方向前行。
求51单片机超声波避障程序?
这是一个超声波避障小车的源程序,可以参考下,用的89C52单片机,舵机控制转角避障。#include
#include
#define Sevro_moto_pwm P2_7 //接舵机信号端输入PWM信号调[繁体:調]节速度
#define ECHO P2_4 //超声波接口定义yì
#define TRIG P2_5 //超声波接口kǒu 定义
#define Left_moto_go {P1_0=1,P1_1=0,P1_2=1,P1_3=0} //左边两个电机向前走(pinyin:zǒu)
#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} //左边两个电机(拼音:jī)停转
#define Right_moto_go {P1_4=1,P1_5=0,P1_6=1,P1_7=0} //右边两个[拼音:gè]电机向前走
#defin澳门威尼斯人e 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} //右边两个电机停{pinyin:tíng}转
unsigned char const discode[] ={ 0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90,0xBF,0xff/*-*/}
unsigned char const positon[3]={ 0xfe,0xfd,0xfb}
unsigned char posit=0
unsigned char pwm_val_left = 0//变量(读:liàng)定义
unsign娱乐城ed char push_val_left =14//舵机归中,产生约,1.5MS 信号《繁:號》
unsigned long S1=0
unsigned long S2=0
unsigned long S3=0
unsigned long S4=0
unsigned int time=0 //时《繁:時》间变量
unsigned int timer=0 //延时基准(zhǔn)变量
unsig世界杯ned char timer1=0 //扫描时间变《繁体:變》量
/************************************************************************/
void delay(unsigned int k) //延《pinyin:yán》时函数
{
unsigned int x,y
for(x=0x
本文链接:http://21taiyang.com/Gyms/264311.html
51单片机《繁体:機》超声波测距原理图转载请注明出处来源