Ex2 - Button
https://gpiozero.readthedocs.io/en/stable/recipes.html#button
任務 1
按下圖連接按扭

另開新檔 button.py。利用以下程式碼,檢查 Button 是否被按下
任務 2
另開新檔 button_wait.py,以下程式碼,會等待按下 (Wait for press) 按扭後才繼續執行程式
任務 3
另開新檔 ,了解以下程式碼,當每次按下按鈕時,會執行 say_hello。
任務 4
另開新檔 button_say_goodbye.py。除了在按下按鈕時執行程式,也可以在放開按鈕時執行程式,如 say_goodbye
Last updated
Was this helpful?