TA的每日心情 | 开心 6 天前 |
---|
签到天数: 1077 天 连续签到: 1 天 [LV.10]以坛为家III
|
发表于 2018-10-29 08:10:22
|
显示全部楼层
void setup()
{
pinMode(PB8, INPUT);
pinMode(PB7, INPUT);
pinMode(iLed, OUTPUT);
}
void loop()
{
digitalWrite(PC13,LOW);
while(1)
{
if((digitalRead(PB7)==LOW)&(digitalRead(PB8)==HIGH))
{
delay(10);
if((digitalRead(PB7)==LOW)&(digitalRead(PB8)==HIGH))
{
digitalWrite(PC13,LOW);
}
}
else if((digitalRead(PB8)==LOW)&(digitalRead(PB7)==HIGH))
{
delay(10);
if((digitalRead(PB8)==LOW)&(digitalRead(PB7)==HIGH))
{
digitalWrite(PC13,HIGH);
}
}
}
}
供参考,希望能帮到你 |
|