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.
This commit is contained in:
Scott Lawson 2016-12-30 22:18:56 -07:00
parent e874ed3b2c
commit 27a0448203

View File

@ -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)