Added reference scripts for startup animation

This commit is contained in:
Thomas Kolb 2019-12-11 22:55:15 +01:00
parent e93c9d042b
commit 0a757fa90f
2 changed files with 83 additions and 0 deletions

37
startup_anim_test.py Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env python3
import sk6812_multistrip as sk6812
import math
import sys
import time
s = sk6812.SK6812(sys.argv[1], 2703)
nled = 16
nstrip = 8
interval = 1/30
for led in range(nled):
for strip in range(nstrip):
s.fade_color(strip, led, 0, 0, 0, 0)
s.commit()
loop = 0
while True:
intensity = int(64 * math.sin(2*math.pi * (loop * interval) * 0.25)**2)
r = 0
g = 0
b = intensity
w = 0
for strip in range(nstrip):
s.set_color(strip, 0, r, g, b, w)
s.commit()
time.sleep(interval)
loop += 1

46
startup_finished.py Executable file
View file

@ -0,0 +1,46 @@
#!/usr/bin/env python3
import sk6812_multistrip as sk6812
import math
import sys
import time
import random
s = sk6812.SK6812(sys.argv[1], 2703)
s.set_fadestep(1)
s.commit()
time.sleep(3)
s.set_fadestep(1)
nled = 16
nstrip = 8
interval = 1/20
for led in range(nled):
for strip in range(nstrip):
s.fade_color(strip, led, 0, 0, 0, 0)
s.commit()
loop = 0
while loop < nled:
led = loop
for strip in range(nstrip):
intensity = 48 + random.randint(0, 32)
g = 0
r = intensity * loop // nled
b = 1*(intensity - intensity * loop // nled) / 2
w = 0
s.set_color(strip, led, r, g, b, w)
s.fade_color(strip, led, 0, 0, 0, 0)
s.commit()
time.sleep(interval)
loop += 1