From 27a04482031725ead8d85eadd9492c76ddea7d64 Mon Sep 17 00:00:00 2001 From: Scott Lawson Date: Fri, 30 Dec 2016 22:18:56 -0700 Subject: [PATCH] Added LED strand test to LED.py Added a test routine to led.py to do a simple LED strand test. The strand test scrolls a red, green, and blue pixel across the LED strip forever. --- python/led.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/python/led.py b/python/led.py index b2b3458..1122e1d 100644 --- a/python/led.py +++ b/python/led.py @@ -27,6 +27,19 @@ def update(): _sock.sendto(m.encode(), (config.UDP_IP, config.UDP_PORT)) +# Execute this file to run a LED strand test +# If everything is working, you should see a red, green, and blue pixel scroll +# across the LED strip continously if __name__ == '__main__': + import time + # Turn all pixels off pixels *= 0 - update() + pixels[0, 0] = 255 # Set 1st pixel red + pixels[1, 1] = 255 # Set 2nd pixel green + pixels[2, 2] = 255 # Set 3rd pixel blue + print('Starting LED strand test') + while True: + pixels = np.roll(pixels, 1, axis=1) + update() + time.sleep(0.2) +