import machine
import time

servo = machine.PWM(machine.Pin(12), freq=50)
while True:
    for angle in range(10, 115, 1):
        servo.duty(angle)
        time.sleep_ms(50)
    for angle in range(115, 10, -1):
        servo.duty(angle)
        time.sleep_ms(50)