#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit in1=P0^0;
sbit in2=P0^1;
sbit in3=P0^2;
sbit in4=P0^3;
sbit key1=P3^4;
sbit key2=P3^5;
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void main()
{
in1=0;
in2=0;
in3=0;
in4=0;
while(1)
{
if(key1==0)
{ delay(5);
if(key1==0)
in1=1;
in2=0;
while(!key1);
}
if(key2==0)
{
delay(5);
if(key2==0)
in3=0;
in4=1;
while(!key2);
}
}
}
按键控制电机控制窗帘
最新推荐文章于 2024-03-06 15:35:10 发布