Skip to content

Instantly share code, notes, and snippets.

@bcc bcc/xmastree.py
Created Dec 9, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.