标题:
超声波避障小车源程序
[打印本页]
作者:
绿格子and黑衬衫
时间:
2017-7-13 15:44
标题:
超声波避障小车源程序
超声波避障 程序
单片机源程序如下:
#include <REGX51.H>
#include <stdio.h>
#define uint unsigned int
uint i,j,k;
void delay(i);
void main()
{
P0=0xFF;
while(1)
{
if(P1_0==0)
{
P2=0x11;
delay(1500);
P2=0x22;
delay(1500);
P2=0x44;
delay(1500);
P2=0x88;
delay(1500);
}
if(P1_0!=0)
{
j=0;
for (j=0;j<13;j++)
{
P2=0x18;
delay(1500);
P2=0x24;
delay(1500);
P2=0x42;
delay(1500);
P2=0x81;
delay(1500);
}
if(P1_0!=0)
{
j=0;
for (j=0;j<23;j++)
{
P2=0x81;
delay(1500);
P2=0x42;
delay(1500);
P2=0x24;
delay(1500);
P2=0x18;
delay(1500);
}
}
if(P1_0!=0)
{
j=0;
for (j=0;j<36;j++)
{
P2=0x18;
delay(1500);
P2=0x24;
delay(1500);
P2=0x42;
delay(1500);
P2=0x81;
delay(1500);
}
}
}
if(P1_0!=0)
{
j=0;
for (j=0;j<52;j++)
{
P2=0x81;
delay(1500);
P2=0x42;
delay(1500);
P2=0x24;
delay(1500);
P2=0x18;
delay(1500);
}
if(P1_0!=0)
{
j=0;
for (j=0;j<65;j++)
{
P2=0x18;
delay(1500);
P2=0x24;
delay(1500);
P2=0x42;
delay(1500);
P2=0x81;
delay(1500);
}
}
if(P1_0!=0)
{
j=0;
for (j=0;j<80;j++)
{
P2=0x81;
delay(1500);
P2=0x42;
delay(1500);
P2=0x24;
delay(1500);
……………………
…………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
所有资料51hei提供下载:
超声波避障小车源程序.zip
(16.96 KB, 下载次数: 21)
2017-7-13 15:44 上传
点击文件名下载附件
超声波避障
下载积分: 黑币 -5
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1