from machine import Pin,Timer
from HCSR04 import HCSR04
trig = Pin(13,Pin.OUT)
echo = Pin(12,Pin.IN)
hc = HCSR04(trig,echo)
def action(tim):
print(hc.getDistance())
tim = Timer(-1)
tim.init(period = 500,mode = Timer.PERIODIC,callback = action)