Last active
February 12, 2016 10:05
-
-
Save bennuttall/88adbaddea47c9ef4af1 to your computer and use it in GitHub Desktop.
pwmled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from gpiozero import LED | |
| from time import sleep | |
| from signal import pause | |
| led1 = LED(4) | |
| led2 = LED(18) | |
| led1.blink(on_time=1, off_time=1) | |
| sleep(1) # so they're blinking opposite | |
| led2.blink(on_time=1, off_time=1) | |
| pause() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from gpiozero import PWMLED | |
| from time import sleep | |
| led1 = PWMLED(4) | |
| led2 = PWMLED(18) | |
| while True: | |
| for i in list(range(101)) + list(reversed(range(100))): | |
| led1.value = i / 100 | |
| led2.value = 1 - (i / 100) | |
| sleep(0.01) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment