from machine import Pin, PWM # I import the PIN library and the PWM library
import time # I import time
servo = PWM(Pin(15)) # Configure pin 15 as a PWM signal output.
servo.freq(50) # Set the frequency to 50
for valor in range(1000,9000,200): # Create a sweep from 1000 to 9000 in steps of 200.
servo.duty_u16(valor) # Update the servo position with each cycle increment.
print("PWM:", valor) # Show the value of the variable in the screen
time.sleep(2) # Pauses 2 miliseconds