Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import time # librería delay
  2. import board # librería placa
  3. import pulseio # librería PWM
  4.  
  5. led = pulseio.PWMOut(board.D13, frequency=50, duty_cycle=0) # Seteo de pin y frecuencia
  6.  
  7. while True:
  8. for i in range(100):
  9. if i < 50:
  10. led.duty_cycle = int(i * 2 * 65535 / 100)
  11. else:
  12. led.duty_cycle = 65535 - int((i - 50) * 2 * 65535 / 100)
  13. time.sleep(0.01)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement