Skip to content

Instantly share code, notes, and snippets.

@codepope
Created November 25, 2017 16:08
Show Gist options
  • Select an option

  • Save codepope/5ffc604016d8fa19d8ac077510ace9d3 to your computer and use it in GitHub Desktop.

Select an option

Save codepope/5ffc604016d8fa19d8ac077510ace9d3 to your computer and use it in GitHub Desktop.
For the Pihut christmas tree...
from gpiozero import LEDBoard
from time import sleep
from signal import pause
treelights=[ 18, 5, 9, 11, 21, 10, 7, 12, 6, 1,14, 3, 20, 24, 13, 15,2, 17, 16, 23,8, 22, 4, 19 ]
treemap={ 1:4, 7:5, 16:6, 22:7, 6:8 , 14:9, 8:10, 21:11, 15:12, 3:13, 19:14, 2:15, 9:16, 10:17, 20:18, 18:19,17:20, 4:21, 24:22, 23:23, 13:
24, 5:25, 12:26, 11:27
}
leds=LEDBoard(*range(4,28), pwm=True)
def labelToPin(l):
return treemap[l]
def toBoard(l):
return labelToPin(l)-4
while True:
for i in treelights:
sleep(0.1)
leds.on(toBoard(i))
for i in treelights:
sleep(0.1)
leds.off(toBoard(i))
@TylonHH
Copy link

TylonHH commented Nov 30, 2017

I see no big difference to the original snippet.

Do you have more codes for this tree?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment