from machine import Pin
from utime import sleep, sleep_ms
from hcsr04 import HCSR04
sensor = HCSR04(trigger_pin=4, echo_pin=16)
while True:
distance = sensor.distance_cm()
print('Distance:', distance, 'cm')
sleep_ms(50)
from machine import Pin
from utime import sleep, sleep_ms
from hcsr04 import HCSR04
sensor = HCSR04(trigger_pin=4, echo_pin=16)
while True:
distance = sensor.distance_cm()
print('Distance:', distance, 'cm')
sleep_ms(50)