void setup() {
for (int i = 0; i < pinCount; thisPin++) {
pinMode(ledPins[thisPin], OUTPUT);
}
}
void loop() {
digitalWrite(1,HIGH);
digitalWrite(7,HIGH);
digitalWrite(11,HIGH);
delay(10000);
digitalWrite(1, LOW);
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
delay(2500);
digitalWrite(1,LOW);
digitalWrite(2,LOW);
digitalWrite(3,HIGH);
digitalWrite(7,LOW);
digitalWrite(4,HIGH);
digitalWrite(5,HIGH);
delay(5000);
digitalWrite(4,LOW);
digitalWrite(9,HIGH);
digitalWrite(11,LOW);
delay(10000);
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
delay(2500);
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);
delay(5000);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
delay(2500);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
digitalWrite(3, LOW);
}
我們正在做一個「高級剎車燈」,所以 在代碼中,我需要添加它,以便在任何時候按下按鈕,在週期結束,它會運行代碼,我該怎麼做?製作按鈕保持變量,並在循環運行代碼結束
我已經嘗試了幾件事情,但每次它都無法正常工作,對此會有什麼簡單的解決方案?
我沒有嘗試過,因爲如果按鈕之前的任何時候按下它不會註冊它, – Kyle1264