from machine import Pin, PWM
import time

#Define GPIO4’s output frequency as 50Hz and its duty cycle as 77, and assign them to PWM
servoPin = Pin(4)
pwm = PWM(servoPin, freq=50)
pwm.duty(25)
time.sleep(1)
pwm.duty(128)
time.sleep(1)
pwm.duty(77)
time.sleep(1)