from hcsr04 import*
from time import*
c=HCSR04(trig=12,echo=13)
s=PWM(Pin(22,Pin.OUT))
s.freq(50)
while True:
    d=c.distance()
    if d<300:
        s.duty(75)
    else:
        s.duty(27)