mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	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:
		| @@ -19,26 +19,21 @@ var blinkstick = require("blinkstick"); | |||||||
|  |  | ||||||
| function BlinkStick(n) { | function BlinkStick(n) { | ||||||
| 	RED.nodes.createNode(this,n); | 	RED.nodes.createNode(this,n); | ||||||
| 	var node = this; |  | ||||||
| 	var p1 = /^#.*/ | 	var p1 = /^#.*/ | ||||||
| 	var p2 = /[0-9]+,[0-9]+,[0-9]+/ | 	var p2 = /[0-9]+,[0-9]+,[0-9]+/ | ||||||
|  |  | ||||||
| 	var led = new blinkstick.findFirst(); | 	this.led = new blinkstick.findFirst(); | ||||||
|  | 	var node = this; | ||||||
|  |  | ||||||
| 	node.log("started"); | 	node.log("started"); | ||||||
| 	this.on("input", function(msg) { | 	this.on("input", function(msg) { | ||||||
| 		if (msg != null) { | 		if (msg != null) { | ||||||
| 			if (led.length > 0) { |  | ||||||
| 				if ((p1.test(msg.payload))|(p2.test(msg.payload))) { | 				if ((p1.test(msg.payload))|(p2.test(msg.payload))) { | ||||||
| 					led.setColor(msg.payload); | 					node.led.setColor(msg.payload); | ||||||
| 				} | 				} | ||||||
| 				else { | 				else { | ||||||
| 					node.error("Incorrect format: "+msg.payload); | 					node.error("Incorrect format: "+msg.payload); | ||||||
| 				} | 				} | ||||||
| 			} |  | ||||||
| 			else { |  | ||||||
| 				node.error("No BlinkStick found"); |  | ||||||
| 			} |  | ||||||
| 		} | 		} | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user