from hcsr05 import HSCR04
from time import sleep
from machine import Pin
sensor = HSCR04(trigger_pin=15, echo_pin=4)
led = Pin(14,Pin.OUT)
while True:
distance = sensor.distance_cm()
if (distance<200):
led.value(1)
else:
led.value(0)
sleep(0,1)