标题:
求大神帮我写一个光电传感器程序
[打印本页]
作者:
wgb
时间:
2017-12-28 18:07
标题:
求大神帮我写一个光电传感器程序
利用两个光电传感器,信号线接到单片机的p2.0和p2.1,人数初始值为rs=0,当2.0检测到信号,然后2.1检测到信号,此时人数加一,反之人数减一。
我自己写的用不了。
作者:
wgb
时间:
2017-12-29 13:38
if(k3==0)
{
while(k4!=0)
{
delay(10);
}
rs++;
while(k4==0);
display(0x83,rs);
while(rs>=sdz)
{
Beep=0;
delay(500);
Beep=1;
delay(500);
}
}
if(k4==0)
{
while(k3!=0)
{
delay(10);
}
rs--;
while(k3==0);
display(0x83,rs);
}
作者:
wgb
时间:
2017-12-29 13:39
if(k3==0)
{
while(k4!=0)
{
delay(10);
}
rs++;
while(k4==0);
display(0x83,rs);
while(rs>=sdz)
{
Beep=0;
delay(500);
Beep=1;
delay(500);
}
}
if(k4==0)
{
while(k3!=0)
{
delay(10);
}
rs--;
while(k3==0);
display(0x83,rs);
}
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1