Advertisement
tdrobotica

Proyecto servomotor banco

Jan 12th, 2022
1,436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. #importar librerias
  2. from machine import Pin, PWM
  3. from time import sleep
  4. #codigo de programa
  5. def main():
  6.     #configuracion de pulso de servo
  7.     pul_servo = PWM(Pin(25))
  8.     pul_servo.freq(60)
  9.     #variables de incremento y de duty inicial
  10.     step = 4
  11.     duty = 60
  12.     #ciclo infinito de programa
  13.     while(1):
  14.         duty = duty + step
  15.         pul_servo.duty(duty)
  16.         #tiempo entre variacion
  17.         sleep(0.2)
  18.        
  19. if __name__ == "__main__":
  20.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement