from machine import PWM,Pin
from time import sleep 
from HC1SR04 import HCSR04 

servo=PWM(Pin(19),freq=50)
sensor = HCSR04(trigger_pin=15, echo_pin=4, echo_timeout_us=25000)

while(1):
  distancia=sensor.distance_cm()
  print(distancia)
  sleep(.5)
  if(distancia<=10):
    servo.duty(70)
    sleep(1)
  else:
    servo.duty(25)