from HCSR04 import HCSR04
import time
import machine
sensor = HCSR04(13, 12)
led1 = machine.Pin(14, machine.Pin.OUT)
led2 = machine.Pin(27, machine.Pin.OUT)
while True:
d = sensor.distance_mm()
if d < 800:
print('!!')
led2.on()
time.sleep(5)
led2.off()
print('dist', d)
time.sleep(0.5)