3Daten plotten
.
1import time
2import board
3import adafruit_hcsr04
4
5sonar = adafruit_hcsr04.HCSR04(trigger_pin=board.D5, echo_pin=board.D6)
6
7while True:
8 try:
9 abstand = sonar.distance
10 print( (abstand,) )
11 except RuntimeError:
12 pass
13 time.sleep(0.1)