import machine
import time
p15=machine.Pin(15,Pin.OUT)
servologo=machine.PWM(p15)
print('servologo')
servologo.freq(50)
servologo.duty(0)
def map(x, in_min, in_max, out_min, out_max):
    return int((x - in_min)*(out_max - out_min)/(in_max-in_min)*out_min)

def servo(pin,angle):
    pin.duty(map(angle,0,180,20,120))
servo(servologo,0)
time.sleep(0.5)
servo(servologo,90)
time.sleep(0.5)
servo(servologo,180)
time.sleep(0.5)