void setup() {
pinMode(10, OUTPUT);
pinMode(13, INPUT);
}
void loop() {
boolean val = true;
unsigned long showtime = millis();
while(true){
unsigned long nowtime = millis();
if (digitalRead(13)) {
showtime = nowtime + 3000;
}
if (nowtime < showtime) {
digitalWrite(10, HIGH);
} else {
digitalWrite(10, LOW);
}
val = !val;
delay(100);
}
}
Arduino按键及延时功能
最新推荐文章于 2023-11-11 16:39:07 发布