neopixel - reallign tabs...

This commit is contained in:
Dave Conway-Jones 2018-11-26 08:30:22 +00:00
parent 174c18a289
commit b34338357f
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
2 changed files with 34 additions and 34 deletions

View File

@ -166,39 +166,39 @@ if __name__ == '__main__':
else:
strip = PixelStrip(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_GAMMA)# Intialize the library (must be called once before other functions).
strip.begin()
strip.begin()
## Color wipe animations.
colorWipe(strip, Color(127, 0, 0), WAIT_MS) # Red wipe
colorWipe(strip, Color(0, 127, 0), WAIT_MS) # Green wipe
colorWipe(strip, Color(0, 0, 127), WAIT_MS) # Blue wipe
colorWipe(strip, Color(0, 0, 0), WAIT_MS) # Off wipe
## Color wipe animations.
colorWipe(strip, Color(127, 0, 0), WAIT_MS) # Red wipe
colorWipe(strip, Color(0, 127, 0), WAIT_MS) # Green wipe
colorWipe(strip, Color(0, 0, 127), WAIT_MS) # Blue wipe
colorWipe(strip, Color(0, 0, 0), WAIT_MS) # Off wipe
## Rainbow animations.
#rainbow(strip)
#rainbowCycle(strip)
#colorWipe(strip, Color(0, 0, 0)) # Off wipe
## Rainbow animations.
#rainbow(strip)
#rainbowCycle(strip)
#colorWipe(strip, Color(0, 0, 0)) # Off wipe
while True:
try:
data = raw_input()
bits = data.split(',')
if len(bits) == 2:
if bits[0] == "brightness":
setBrightness(strip, min(255,max(0,int(bits[1]))), WAIT_MS)
if len(bits) == 3:
if MODE == "shiftu":
shiftUp(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
elif MODE == "shiftd":
shiftDown(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
else:
colorWipe(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
if (MODE[0] == 'p' and len(bits) == 4):
setPixel(strip, int(bits[0]), Color(int(bits[1]), int(bits[2]), int(bits[3]) ))
if (MODE[0] == 'p' and len(bits) == 5):
setPixels(strip, int(bits[0]), int(bits[1]), Color(int(bits[2]), int(bits[3]), int(bits[4]) ), WAIT_MS)
except (EOFError, SystemExit): # hopefully always caused by us sigint'ing the program
sys.exit(0)
except Exception as ex:
print("bad data: "+data)
print(ex)
while True:
try:
data = raw_input()
bits = data.split(',')
if len(bits) == 2:
if bits[0] == "brightness":
setBrightness(strip, min(255,max(0,int(bits[1]))), WAIT_MS)
if len(bits) == 3:
if MODE == "shiftu":
shiftUp(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
elif MODE == "shiftd":
shiftDown(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
else:
colorWipe(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
if (MODE[0] == 'p' and len(bits) == 4):
setPixel(strip, int(bits[0]), Color(int(bits[1]), int(bits[2]), int(bits[3]) ))
if (MODE[0] == 'p' and len(bits) == 5):
setPixels(strip, int(bits[0]), int(bits[1]), Color(int(bits[2]), int(bits[3]), int(bits[4]) ), WAIT_MS)
except (EOFError, SystemExit): # hopefully always caused by us sigint'ing the program
sys.exit(0)
except Exception as ex:
print("bad data: "+data)
print(ex)

View File

@ -1,6 +1,6 @@
{
"name" : "node-red-node-pi-neopixel",
"version" : "0.0.23",
"version" : "0.0.24",
"description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.",
"dependencies" : {
},