|
路口一(紅)路口二(綠轉黃)在來路口一(紅轉綠)路口二(黃轉紅)
這句話就是解答了
路口一(紅)路口二(綠轉黃)
digitalWrite(LEDRed1, HIGH);
digitalWrite(LEDGreen2, HIGH);
delay(2000);
digitalWrite(LEDGreen2, LOW);
digitalWrite(LEDYellow2 , HIGH);
在來路口一(紅轉綠)路口二(黃轉紅)
digitalWrite(LEDRed1, LOW);
digitalWrite(LEDGreen1, HIGH);
digitalWrite(LEDYellow2 , LOW);
digitalWrite(LEDRed2, HIGH);
兩段加起來
BUTTON_STSTE = digitalRead(BUTTON_PIN);
if(BUTTON_STSTE == HIGH){
digitalWrite(LEDRed1, HIGH);
digitalWrite(LEDGreen2, HIGH);
delay(2000);
digitalWrite(LEDGreen2, LOW);
digitalWrite(LEDYellow2 , HIGH);
digitalWrite(LEDRed1, LOW);
digitalWrite(LEDGreen1, HIGH);
digitalWrite(LEDYellow2 , LOW);
digitalWrite(LEDRed2, HIGH);
}
這不是書中會有的答案,而是你得看懂書寫的東西
自己去想出來的流程
就好像課本只會教公式
遇到題目如何解你還是要自己想 |
|