from machine import Pin, PWM
import time
# initilize PWM on GPIO Pin 15
servo = PWM(Pin(15))
#Set Frequency: 50Hz is the standard to control servo smoothness [2]
servo.freq(50)
while True:
#Equivalent to servo.min()
#Controls the position using a 16-bit iteger [2]
servo.duty_u16(2000)
time.sleep(1)
#Equivalent to servo.mid() (approx 90 degrees or a 1.5ms pulse) [3]
servo.duty_u16(4915)
time.sleep(1)
#Equivalent to servo.max()
servo.duty_u16(8000)
time.sleep(1)