Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #importar librerias
- from machine import Pin, PWM
- from time import sleep
- #codigo de programa
- def main():
- #configuracion de pulso de servo
- pul_servo = PWM(Pin(25))
- pul_servo.freq(60)
- #variables de incremento y de duty inicial
- step = 4
- duty = 60
- #ciclo infinito de programa
- while(1):
- duty = duty + step
- pul_servo.duty(duty)
- #tiempo entre variacion
- sleep(0.2)
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement