Ex5 - Distance Sensor

https://gpiozero.readthedocs.io/en/stable/recipes.html#distance-sensor

任務 1

另開新檔 distance.py 利用以程式碼使 Distance Sensor 檢測到最近物體的距離

Warning on SoftBank 2014同學必須注意四支針腳的名稱,分別是 VCC, Trig, Echo, GND,不可以連接錯誤Warning on SoftBank 2014

任務 2

另開新檔 distance_2.py,以下程式碼為當有東西靠近傳感器時,LED 會亮。按以下程式碼連接所需裝置。

  • threshold - 啟動值

Last updated

Was this helpful?