from machine import Pin,PWM
from time import sleep
push=Pin(25,Pin.IN,Pin.PULL_DOWN)
servo=PWM(Pin(22),freq=50)
v=25
while(1):
if push.value()==0:
servo.duty(v)
sleep(2)
v=v+2
if v>125:
v=25
else:
servo.duty(v)
sleep(0.5)
v=v-3
if v<25:
v=125