1Abstandsmessung
.
1import time
2import board
3import adafruit_hcsr04
4
5sonar = adafruit_hcsr04.HCSR04(trigger_pin=board.D5, echo_pin=board.D6)
6
7while True:
8 abstand = sonar.distance
9 print( abstand )
10 time.sleep(0.1)
Kurse
.
1import time
2import board
3import adafruit_hcsr04
4
5sonar = adafruit_hcsr04.HCSR04(trigger_pin=board.D5, echo_pin=board.D6)
6
7while True:
8 abstand = sonar.distance
9 print( abstand )
10 time.sleep(0.1)