求基于51单片机的超声波避障智能小车程序?避障的话,最好能用两个以上超声波模块,这样做就可以不用步进电机了。你可以把两到三个超声波模块按一定角度装到车的前部,这样就可以根据三个超声波模块回收的距离信息来判断哪个方向有障碍物,从而选择正确的方向前行
求基于51单片机的超声波避障智能小车程序?
避障的话,最好能用两个以上超声波模块,这样做就可以不用步进电机了。你可以把两到三个超声波模块按一定角度装到车的前【练:qián】部,这样就《jiù》可以根据三个超声波模块回收的距离信息来判断哪个方向有障碍物,从而选择正确的方向前行。
求51单片机超声波避障程序?
这是一个超声波避障小车的源程序,可以参考下,用的89C52单片机,舵机控制转角避障。#include
#include
#define Sevro_moto_pwm P2_7 //接舵机信号{练:hào}端输入PWM信号调节速度
#define ECHO P2_4 //超声波接口定义{pinyin:yì}
#define TRIG P2_5 //超声波接口定《练:dìng》义
#define L极速赛车/北京赛车eft_moto_go {P1_0=1,P1_1=0,P1_2=1,P1_3=0} //左边两个电机(拼音:jī)向前走
#define Left_moto_back {P1_0=0,P1_1=1,P1_2=0,P1_3=1} //左边两个电机向【pinyin:xiàng】后转
#define Left_moto_Stop {P1_0=0,P1_1=0,P1_2=0,P1_3=0} //左边两个(读:gè)电机停转
#define Right_moto_go {P1_4=1,P1_5=0,P1_6=1,P1_7=0} //右边两《繁体:兩》个电机向前走
#define Right_moto_back {P1_4=0,P1_5=1,P1_6=0,P1_7=1} //右边两个电机向前走{读:zǒu}
#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 posit=0
unsigned char pwm_val_left = 0//变量定dìng 义
unsigned char push_val_left =14//舵机归中,产生约,1.5MS 信【读:xìn】号
unsigned long S=0
unsigned long S1=0
unsigned long S2=0
unsigned long S4=0
unsigned int time=0 //时间变[繁:變]量
unsigned int timer=0 //延时基准变量
unsigned char timer1=0 //扫sǎo 描时间变量
void delay(unsigned int k) //延(练:yán)时函数
unsigned int x,y
for(x=0x
本文链接:http://21taiyang.com/Business-Operations/264311.html
51单片机超声波(拼音:bō)测距原理图转载请注明出处来源