"""
MicroPython Servo Sweeper for Wokwi.com
This MicroPython script, designed for Wokwi.com, controls a servo motor
connected to GPIO pin 18. The program uses MicroPython's machine library
for basic PWM control, creating an intermittent sweeping motion of the
servo motor between 0 and 180 degrees.
Instructions:
1. Upload and run this script on the Wokwi.com ESP32 simulation platform.
2. Observe the simulated servo motor's sweeping motion between 0 and
180 degrees.
Note:
- This script is tailored for use on the Wokwi.com platform, providing a
visual representation of servo motor control in a simulated environment.
Author: Jorge A. Perales Saavedra
Date: 25/11/2023
"""
from machine import Pin, PWM
from utime import sleep, sleep_ms
#Configuramos el pin al que estará conectado el servo
servo = PWM(Pin(18), freq = 50)
while True:
servo.duty_u16(1800)
sleep_ms(1)
servo.duty_u16(8000)
sleep_ms(1)