# Import Library
from servo import Servo
from machine import Pin
from time import sleep
# Pin Setup
servo = Servo(12)
# Reset the servo angle to 0 before entering the loop.
servo.write(0)
# Read the current servo angle
print("current angle:",servo.read())
while True:
# Set the servo angle to 90 degree
servo.write(90)
# Read the current servo angle
print("current angle:",servo.read())
# Delay 1 Second
sleep(1)
# Reset the servo back to 0 degree
servo.write(0)
# Read the current servo angle
print("current angle:",servo.read())
# Delay 1 Second
sleep(1)