Created
December 9, 2017 21:02
-
-
Save bcc/a950272b3d0f80dccd76219d32e8d831 to your computer and use it in GitHub Desktop.
The Pi Hut LED Christmas Tree serene mode
This file contains 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 LEDBoard | |
from signal import pause | |
from time import sleep | |
steps=30 | |
brightness = 0.1/steps | |
delay=0.01 | |
leds = LEDBoard(*range(2,28),pwm=True) | |
while True: | |
for x in range(1, 26): | |
for y in range(steps): | |
leds[x].value = y*brightness | |
leds[0].value = (x+(y*brightness)-1)*0.02*brightness*steps | |
sleep(delay) | |
for x in range(1, 26): | |
for y in reversed(range(steps)): | |
leds[x].value = y*brightness | |
leds[0].value = (25-(x-(y*brightness)))*0.02*brightness*steps | |
sleep(delay) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment