over zealous error checking for device... - now under zealous - tricky to debug without actual hardware in hand :-) 4/10 must try harder

This commit is contained in:
Dave C-J 2013-09-08 16:45:51 +01:00
parent 163d0c624a
commit 9a26916d29
1 changed files with 3 additions and 8 deletions

View File

@ -19,26 +19,21 @@ var blinkstick = require("blinkstick");
function BlinkStick(n) {
RED.nodes.createNode(this,n);
var node = this;
var p1 = /^#.*/
var p2 = /[0-9]+,[0-9]+,[0-9]+/
var led = new blinkstick.findFirst();
this.led = new blinkstick.findFirst();
var node = this;
node.log("started");
this.on("input", function(msg) {
if (msg != null) {
if (led.length > 0) {
if ((p1.test(msg.payload))|(p2.test(msg.payload))) {
led.setColor(msg.payload);
node.led.setColor(msg.payload);
}
else {
node.error("Incorrect format: "+msg.payload);
}
}
else {
node.error("No BlinkStick found");
}
}
});