標(biāo)題:
超聲波避障小車源程序
[打印本頁]
作者:
綠格子and黑襯衫
時間:
2017-7-13 15:44
標(biāo)題:
超聲波避障小車源程序
超聲波避障 程序
單片機源程序如下:
#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黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
超聲波避障小車源程序.zip
(16.96 KB, 下載次數(shù): 21)
2017-7-13 15:44 上傳
點擊文件名下載附件
超聲波避障
下載積分: 黑幣 -5
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1