Skip to content

Instantly share code, notes, and snippets.

@bcc
Created December 9, 2017 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcc/a950272b3d0f80dccd76219d32e8d831 to your computer and use it in GitHub Desktop.
Save bcc/a950272b3d0f80dccd76219d32e8d831 to your computer and use it in GitHub Desktop.
The Pi Hut LED Christmas Tree serene mode
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