From dd8bcc2da80d15280b9aa94cec648fbdac576cc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Tue, 18 Jul 2017 20:11:12 +0200 Subject: Add matrix --- turtetris_slave/leds.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 turtetris_slave/leds.py (limited to 'turtetris_slave/leds.py') diff --git a/turtetris_slave/leds.py b/turtetris_slave/leds.py new file mode 100644 index 0000000..cdafca2 --- /dev/null +++ b/turtetris_slave/leds.py @@ -0,0 +1,38 @@ +from subprocess import call + + +def prepare(): + "Prepare leds" + call("rainbow all enable intensity 10 FFFFFF", shell=True) + + +def clear(): + "Clear previous changes" + call("rainbow all auto", shell=True) + + +__MAP__ = [ + 'pwr', + 'lan0', + 'lan1', + 'lan2', + 'lan3', + 'lan4', + 'wan', + 'pci1', + 'pci2', + 'pci3', + 'usr1', + 'usr2' +] + + +def output(data): + "Output received data to leds" + args = ['rainbow'] + for i in range(0, 12): + args.append(__MAP__[i]) + args.append(str(data[i]['color'])) + args.append('intensity') + args.append(str(data[i]['intens'])) + call(args) -- cgit v1.2.3