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

add complete node support to gpio out node (#647)

This commit is contained in:
Hiroyasu Nishiyama 2020-04-21 19:46:03 +09:00 committed by GitHub
parent 4641d10beb
commit 67c3d251e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,7 +129,7 @@ module.exports = function(RED) {
}
}
function inputlistener(msg) {
function inputlistener(msg, send, done) {
if (msg.payload === "true") { msg.payload = true; }
if (msg.payload === "false") { msg.payload = false; }
var out = Number(msg.payload);
@ -138,7 +138,11 @@ module.exports = function(RED) {
if ((out >= 0) && (out <= limit)) {
if (RED.settings.verbose) { node.log("out: "+out); }
if (node.child !== null) {
node.child.stdin.write(out+"\n");
node.child.stdin.write(out+"\n", () => {
if (done) {
done();
}
});
node.status({fill:"green",shape:"dot",text:msg.payload.toString()});
}
else {