標(biāo)題:
智能循跡小車前進(jìn)后退代碼
[打印本頁(yè)]
作者:
合同方
時(shí)間:
2018-3-26 15:34
標(biāo)題:
智能循跡小車前進(jìn)后退代碼
QQ圖片20180326153345.jpg
(3.18 MB, 下載次數(shù): 24)
下載附件
2018-3-26 15:33 上傳
單片機(jī)源程序如下:
#include<reg51.h>
#define ucahr unsigned char
#define uint unsigned int
#define uchar unsigned char
sbit BZ=P3^5;
sbit P00=P0^0;
sbit P01=P0^1;
sbit P02=P0^2;
sbit P03=P0^3;
void delay(uchar x)
{
uchar y;
for(;x>0;x--)
for(y=120;y>0;y--) ;
}
void main()
{
while(1)
{
P00=1;
P01=0;
P02=1;
P03=0;
if(BZ==0)
{
P00=0;
P01=1;
P02=0;
P03=1;
delay(100);
}
}
}
復(fù)制代碼
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1