1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Arduino pin values should be strings not numbers

This commit is contained in:
Nick O'Leary 2015-04-15 09:34:03 +01:00
parent d090df94c5
commit 78ab4217be

View File

@ -121,10 +121,10 @@ module.exports = function(RED) {
node.board.pinMode(node.pin, node.state); node.board.pinMode(node.pin, node.state);
node.on("input", function(msg) { node.on("input", function(msg) {
if (node.state === "OUTPUT") { if (node.state === "OUTPUT") {
if ((msg.payload === true)||(msg.payload.toString() == 1)||(msg.payload.toString().toLowerCase() == "on")) { if ((msg.payload === true)||(msg.payload.toString() == "1")||(msg.payload.toString().toLowerCase() == "on")) {
node.board.digitalWrite(node.pin, true); node.board.digitalWrite(node.pin, true);
} }
if ((msg.payload === false)||(msg.payload.toString() == 0)||(msg.payload.toString().toLowerCase() == "off")) { if ((msg.payload === false)||(msg.payload.toString() == "0")||(msg.payload.toString().toLowerCase() == "off")) {
node.board.digitalWrite(node.pin, false); node.board.digitalWrite(node.pin, false);
} }
} }