mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
neopixel - reallign tabs...
This commit is contained in:
parent
174c18a289
commit
b34338357f
@ -166,39 +166,39 @@ if __name__ == '__main__':
|
|||||||
else:
|
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 = 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.
|
## Color wipe animations.
|
||||||
colorWipe(strip, Color(127, 0, 0), WAIT_MS) # Red wipe
|
colorWipe(strip, Color(127, 0, 0), WAIT_MS) # Red wipe
|
||||||
colorWipe(strip, Color(0, 127, 0), WAIT_MS) # Green 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, 127), WAIT_MS) # Blue wipe
|
||||||
colorWipe(strip, Color(0, 0, 0), WAIT_MS) # Off wipe
|
colorWipe(strip, Color(0, 0, 0), WAIT_MS) # Off wipe
|
||||||
|
|
||||||
## Rainbow animations.
|
## Rainbow animations.
|
||||||
#rainbow(strip)
|
#rainbow(strip)
|
||||||
#rainbowCycle(strip)
|
#rainbowCycle(strip)
|
||||||
#colorWipe(strip, Color(0, 0, 0)) # Off wipe
|
#colorWipe(strip, Color(0, 0, 0)) # Off wipe
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
data = raw_input()
|
data = raw_input()
|
||||||
bits = data.split(',')
|
bits = data.split(',')
|
||||||
if len(bits) == 2:
|
if len(bits) == 2:
|
||||||
if bits[0] == "brightness":
|
if bits[0] == "brightness":
|
||||||
setBrightness(strip, min(255,max(0,int(bits[1]))), WAIT_MS)
|
setBrightness(strip, min(255,max(0,int(bits[1]))), WAIT_MS)
|
||||||
if len(bits) == 3:
|
if len(bits) == 3:
|
||||||
if MODE == "shiftu":
|
if MODE == "shiftu":
|
||||||
shiftUp(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
|
shiftUp(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
|
||||||
elif MODE == "shiftd":
|
elif MODE == "shiftd":
|
||||||
shiftDown(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
|
shiftDown(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
|
||||||
else:
|
else:
|
||||||
colorWipe(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
|
colorWipe(strip, Color(int(bits[0]), int(bits[1]), int(bits[2])), WAIT_MS)
|
||||||
if (MODE[0] == 'p' and len(bits) == 4):
|
if (MODE[0] == 'p' and len(bits) == 4):
|
||||||
setPixel(strip, int(bits[0]), Color(int(bits[1]), int(bits[2]), int(bits[3]) ))
|
setPixel(strip, int(bits[0]), Color(int(bits[1]), int(bits[2]), int(bits[3]) ))
|
||||||
if (MODE[0] == 'p' and len(bits) == 5):
|
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)
|
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
|
except (EOFError, SystemExit): # hopefully always caused by us sigint'ing the program
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
print("bad data: "+data)
|
print("bad data: "+data)
|
||||||
print(ex)
|
print(ex)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-pi-neopixel",
|
"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.",
|
"description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user