mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
let LEDborg handle numeric numbers
just helps make it more resilient.
This commit is contained in:
parent
5568238058
commit
617e6809b5
@ -57,6 +57,14 @@ module.exports = function(RED) {
|
|||||||
function inputlistener(msg) {
|
function inputlistener(msg) {
|
||||||
var rgb = "000";
|
var rgb = "000";
|
||||||
|
|
||||||
|
if (typeof msg.payload === "number") {
|
||||||
|
msg.payload = ("000"+msg.payload.toString()).substr(-3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof msg.payload === "boolean") {
|
||||||
|
msg.payload = msg.payload ? "222" : "000";
|
||||||
|
}
|
||||||
|
|
||||||
if (p1.test(msg.payload)) {
|
if (p1.test(msg.payload)) {
|
||||||
rgb = msg.payload;
|
rgb = msg.payload;
|
||||||
rgb = Number(rgb[0])*50+","+Number(rgb[1])*50+","+Number(rgb[2])*50;
|
rgb = Number(rgb[0])*50+","+Number(rgb[1])*50+","+Number(rgb[2])*50;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-ledborg",
|
"name" : "node-red-node-ledborg",
|
||||||
"version" : "0.0.11",
|
"version" : "0.0.12",
|
||||||
"description" : "A Node-RED node to control a PiBorg LedBorg board for a Raspberry Pi.",
|
"description" : "A Node-RED node to control a PiBorg LedBorg board for a Raspberry Pi.",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user