from machine import Pin,time_pulce_us
import time
trig_pin = Pin(4,Pin.OUT)
echo_pin = Pin(5,Pin.IN)
while True:
# trigger the sensor
trig_pin.value(0)
time.sleep_us(2)
trig_pin.value(1)
time.sleep_us(10)
trig_pin.value(0)
#measure the duration of the echo pulse
duration_us = time_pulse_us(echo-pin,1)
#calcule t6he distance based on the duration
distance-cm = duration-us /58.0
print("Distance:",distance_cm,"cm")
time.sleep(1)