fixed errors caused by code restructure

This commit is contained in:
Lucca Ketterer 2020-06-08 00:02:50 +02:00
parent 282c3f3a39
commit f71718c5aa
2 changed files with 18 additions and 14 deletions

View File

@ -1,3 +1,7 @@
import sys
import time
import ws2801
def color_cycle(speed):
if int(speed) == 0:
delay = 0
@ -11,20 +15,20 @@ def color_cycle(speed):
while r > 0:
r = r-1
g = g+1
set_color(r,g,b)
ws2801.set_color(r,g,b)
time.sleep(delay)
while g > 0:
g = g-1
b = b+1
set_color(r,g,b)
ws2801.set_color(r,g,b)
time.sleep(delay)
while b > 0:
b = b-1
r = r+1
set_color(r,g,b)
ws2801.set_color(r,g,b)
time.sleep(delay)
def visualizer():
for volume in sys.stdin:
volume = int(volume)
set_color(volume,0,0)
ws2801.set_color(volume,0,0)

View File

@ -1,10 +1,10 @@
#!/usr/bin/env python3
import sys
import getopt
import time
import "ws2801"
import "server"
import ws2801
import server
import color_mode
def helpmenu():
print("Options:")
@ -15,7 +15,7 @@ def helpmenu():
def main(argv):
if not sys.stdin.isatty():
visualizer()
color_mode.visualizer()
sys.exit()
try:
@ -30,13 +30,13 @@ def main(argv):
helpmenu()
sys.exit()
elif opt == "-s":
r,g,b = hex_to_rgb(arg)
set_color(r,g,b)
r,g,b = ws2801.hex_to_rgb(arg)
ws2801.set_color(r,g,b)
sys.exit()
elif opt == "-c":
color_cycle(arg)
elif opt == "-d":
start_server()
color_mode.color_cycle(arg)
elif opt == "-d":
server.start()
helpmenu()
sys.exit()