from segment import*
from machine import Pin,time_pulse_us
from utime import sleep,sleep_us
echo = Pin(20, Pin.IN)
trigger = Pin(19, Pin.OUT)
def get_distance():
trigger.value(1)
sleep_us(10)
trigger.value(0)
timing=time_pulse_us(echo,1,1000000)
distance=timing/58
return distance
while 1:
display(get_distance())
sleep(0.5)