34 lines
691 B
Python
34 lines
691 B
Python
import sys
|
|
import time
|
|
import ws2801
|
|
|
|
def color_cycle(speed):
|
|
if int(speed) == 0:
|
|
delay = 0
|
|
else:
|
|
delay = 1/int(speed) * 10
|
|
|
|
r = 255
|
|
g = 0
|
|
b = 0
|
|
while True:
|
|
while r > 0:
|
|
r = r-1
|
|
g = g+1
|
|
ws2801.set_color(r,g,b)
|
|
time.sleep(delay)
|
|
while g > 0:
|
|
g = g-1
|
|
b = b+1
|
|
ws2801.set_color(r,g,b)
|
|
time.sleep(delay)
|
|
while b > 0:
|
|
b = b-1
|
|
r = r+1
|
|
ws2801.set_color(r,g,b)
|
|
time.sleep(delay)
|
|
|
|
def visualizer():
|
|
for volume in sys.stdin:
|
|
volume = int(volume)
|
|
ws2801.set_color(volume,0,0) |