求基于51单片机的超声波避障智能小车程序?避障的话,最好能用两个以上超声波模块,这样做就可以不用步进电机了。你可以把两到三个超声波模块按一定角度装到车的前部,这样就可以根据三个超声波模块回收的距离信息来判断哪个方向有障碍物,从而选择正确的方向前行
求基于51单片机的超声波避障智能小车程序?
避障的话,最好能用两个以上超声波模块,这样做就可以不用步进电机了。你可以把两到三个超声波模块按一定角度装到车的前部,这样就可以根据三个世界杯超声波模块回收的距离信息来判断哪个方向有障碍物wù ,从而选择正确的方向前行。
求51单片机超声波避障程序?
这是一个超声波避障小车的源程序,可以参考下,用的89C52单片机,舵机控制转角避障。#include
#include
#define Sevro_moto_pwm P2_7 //接舵机信号端输入[读:rù]PWM信号调节速度
世界杯#define ECHO P2_4 //超声波接[读:jiē]口定义
#define TRIG P2_5 //超声波《读:bō》接口定义
开云体育#define Left_moto_go {P1_0=1,P1_1=0,P1_2=1,P1_3=0} //左边两个电机[拼音:jī]向前走
#de澳门博彩fine Left_moto_back {P1_0=0,P1_1=1,P1_2=0,P1_3=1} //左边biān 两个电机向后转
#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} //右边两个电机[拼音:jī]向前走
#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} //右边两个电机停转
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 disbuff[4] ={ 0,0,0,0,}
unsigned char posit=0
unsigned char pwm_val_left = 0//变[繁体:變]量定义
unsigned char push_val_left =14//舵机归中,产生【shēng】约,1.5MS 信号
unsigned long S=0
unsigned long S1=0
unsigned long S2=0
unsigned long S3=0
unsigned long S4=0
unsigned int time=0 //时{练:shí}间变量
澳门银河unsigned int timer=0 //延时基【jī】准变量
unsigned char timer1=0 //扫描时间(繁:間)变量
/************************************************************************/
void delay(unsigned int k) //延时(shí)函数
{
unsigned int x,y
for(x=0x
本文链接:http://10.21taiyang.com/Health-Conditions/264311.html
51单片机超声波测距【jù】原理图转载请注明出处来源