Advertisement
silver2row

Fade?

Sep 11th, 2022
779
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. from PWM import Pwm
  4. from time import sleep
  5.  
  6. # Use for PWM on /dev/bone/pwm/
  7. # see https://pastebin.com/R70P1wAn
  8.  
  9. LED = Pwm('/dev/bone/pwm/1/b', frequency=50)
  10.  
  11. try:
  12.     while True:
  13.         LED.value = 0.8
  14.         sleep(5)
  15.         LED.value = 0.0
  16.         sleep(5)
  17.     for i in range(0, 1):
  18.         Pwm.duty_cycle(LED, i)
  19.         sleep(0.2)
  20.     for i in range(1, 0, 1):
  21.         Pwm.duty_cycle(LED, i)
  22.         sleep(0.2)
  23. except KeyboardInterrupt:
  24.     print ("You have done it now!")
  25.     LED.disable()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement