當前位置:編程學習大全網 - 電腦編程 - 對照式光電傳感器 c語言 單片機 編程

對照式光電傳感器 c語言 單片機 編程

#include<reg52.h>

#define uchar unsigned char

#define uint unsigned int

void delay(uchar z)

{

unsigned int x,y;

for(x=0;x<z;x++)

for(y=0;y<110;y++);

}

sbit a=P1^0;

sbit b=P1^1;

sbit c=P1^2;

void main()

{

while(1)

{

if(b==1)

a=0;

delay(100);

a=1;

if(b==0)

c=0;

delay(100);

c=1;

}

}

  • 上一篇:Ug帝國編程模板
  • 下一篇:編程背景的顏色變化
  • copyright 2024編程學習大全網