Ex3 - Button controlled LED

https://gpiozero.readthedocs.io/en/stable/recipes.html#button-controlled-led

任務 1

另開新檔。以下程式碼,在按下 Button 時打開 LED

任務 2

另開新檔, button_led_2.py。參考 Ex2 - Button 中的任務4,修改以上程式碼,讓你可以在當按下按扭時開啟/閃動 LED,放手時會關閉 LED。以下是你可能需要用的資料連結。

Last updated

Was this helpful?