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:
parent
d090df94c5
commit
78ab4217be
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user