mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Update LEDborg - to match Pi node colours and update python
This commit is contained in:
parent
b6bbcbd52f
commit
ddacd61ab0
@ -26,15 +26,15 @@
|
||||
<p>PiBorg LedBorg LED output node. Expects a <b>msg.payload</b> with a three digit rgb triple, from <b>000</b> to <b>222</b>.</p>
|
||||
<p>See <i><a href="http://www.piborg.com/ledborg/install" target="_new">the PiBorg site</a></i> for more information.</p>
|
||||
<p>You can also use a <b>msg.payload</b> in the standard hex format "#rrggbb".</p>
|
||||
<p>You can also use the @cheerlight colour names - red, amber, green, blue, cyan, magenta, yellow, orange, pink, purple,
|
||||
white, warmwhite, black</p>
|
||||
<p>You may also supply a comma seperated rrr,ggg,bbb where the value can be between 0 and 255.</p>
|
||||
<p>You can also use the @cheerlight colour names - red, amber, green, blue,
|
||||
cyan, magenta, yellow, orange, pink, purple, white, warmwhite, black</p>
|
||||
<p>You may also supply a comma separated rrr,ggg,bbb where each value can be between 0 and 255.</p>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('ledborg',{
|
||||
category: 'Raspberry Pi',
|
||||
color:"GoldenRod",
|
||||
color:"#c6dbef",
|
||||
defaults: {
|
||||
name: {value:""}
|
||||
},
|
||||
|
@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright 2014 IBM Corp.
|
||||
#
|
||||
|
@ -19,6 +19,10 @@ import sys
|
||||
|
||||
bounce = 20 # bounce time in mS to apply
|
||||
|
||||
if sys.version_info >= (3,0):
|
||||
print("Sorry - currently only configured to work with python 2.x")
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
cmd = sys.argv[1].lower()
|
||||
pin = int(sys.argv[2])
|
||||
@ -34,11 +38,10 @@ if len(sys.argv) > 1:
|
||||
while True:
|
||||
try:
|
||||
data = raw_input()
|
||||
if data == "close":
|
||||
GPIO.cleanup(pin)
|
||||
if 'close' in data:
|
||||
sys.exit(0)
|
||||
p.ChangeDutyCycle(float(data))
|
||||
except EOFError: # hopefully always caused by us sigint'ing the program
|
||||
except (EOFError, SystemExit): # hopefully always caused by us sigint'ing the program
|
||||
GPIO.cleanup(pin)
|
||||
sys.exit(0)
|
||||
except Exception as ex:
|
||||
@ -53,15 +56,14 @@ if len(sys.argv) > 1:
|
||||
while True:
|
||||
try:
|
||||
data = raw_input()
|
||||
if data == "close":
|
||||
GPIO.cleanup(pin)
|
||||
if 'close' in data:
|
||||
sys.exit(0)
|
||||
elif float(data) == 0:
|
||||
p.stop()
|
||||
else:
|
||||
p.start(50)
|
||||
p.ChangeFrequency(float(data))
|
||||
except EOFError: # hopefully always caused by us sigint'ing the program
|
||||
except (EOFError, SystemExit): # hopefully always caused by us sigint'ing the program
|
||||
GPIO.cleanup(pin)
|
||||
sys.exit(0)
|
||||
except Exception as ex:
|
||||
@ -76,11 +78,10 @@ if len(sys.argv) > 1:
|
||||
while True:
|
||||
try:
|
||||
data = raw_input()
|
||||
if data == "close":
|
||||
GPIO.cleanup(pin)
|
||||
if 'close' in data:
|
||||
sys.exit(0)
|
||||
data = int(data)
|
||||
except EOFError: # hopefully always caused by us sigint'ing the program
|
||||
except (EOFError, SystemExit): # hopefully always caused by us sigint'ing the program
|
||||
GPIO.cleanup(pin)
|
||||
sys.exit(0)
|
||||
except:
|
||||
@ -109,10 +110,9 @@ if len(sys.argv) > 1:
|
||||
while True:
|
||||
try:
|
||||
data = raw_input()
|
||||
if data == "close":
|
||||
GPIO.cleanup(pin)
|
||||
if 'close' in data:
|
||||
sys.exit(0)
|
||||
except EOFError: # hopefully always caused by us sigint'ing the program
|
||||
except (EOFError, SystemExit): # hopefully always caused by us sigint'ing the program
|
||||
GPIO.cleanup(pin)
|
||||
sys.exit(0)
|
||||
|
||||
@ -124,11 +124,10 @@ if len(sys.argv) > 1:
|
||||
while True:
|
||||
try:
|
||||
data = raw_input()
|
||||
if data == "close":
|
||||
GPIO.cleanup()
|
||||
if 'close' in data:
|
||||
sys.exit(0)
|
||||
data = int(data)
|
||||
except EOFError: # hopefully always caused by us sigint'ing the program
|
||||
except (EOFError, SystemExit): # hopefully always caused by us sigint'ing the program
|
||||
GPIO.cleanup()
|
||||
sys.exit(0)
|
||||
except:
|
||||
@ -155,14 +154,13 @@ if len(sys.argv) > 1:
|
||||
while True:
|
||||
try:
|
||||
data = raw_input()
|
||||
if data == "close":
|
||||
GPIO.cleanup()
|
||||
if 'close' in data:
|
||||
sys.exit(0)
|
||||
c = data.split(",")
|
||||
r.ChangeDutyCycle(float(c[0]))
|
||||
g.ChangeDutyCycle(float(c[1]))
|
||||
b.ChangeDutyCycle(float(c[2]))
|
||||
except EOFError: # hopefully always caused by us sigint'ing the program
|
||||
except (EOFError, SystemExit): # hopefully always caused by us sigint'ing the program
|
||||
GPIO.cleanup()
|
||||
sys.exit(0)
|
||||
except:
|
||||
@ -196,4 +194,4 @@ if len(sys.argv) > 1:
|
||||
sys.exit(0)
|
||||
|
||||
else:
|
||||
print "Bad parameters - {in|out|pwm} {pin} {value|up|down}"
|
||||
print "Bad parameters - in|out|pwm|buzz|byte|borg|mouse|ver pin {value|up|down}"
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-ledborg",
|
||||
"version" : "0.0.7",
|
||||
"version" : "0.0.9",
|
||||
"description" : "A Node-RED node to control a PiBorg LedBorg board for a Raspberry Pi.",
|
||||
"dependencies" : {
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user