diff --git a/hardware/PiLiter/39-rpi-piliter.js b/hardware/PiLiter/39-rpi-piliter.js index 10f24058..ac6b1ec9 100644 --- a/hardware/PiLiter/39-rpi-piliter.js +++ b/hardware/PiLiter/39-rpi-piliter.js @@ -69,9 +69,8 @@ module.exports = function(RED) { var l = Number(msg.payload.state); if ((out >= 1) && (out <= 8)) { out = (Math.pow(2, (out-1))); - if (l === 0) { out = ~ out; } - byte = byte & out & 255; - console.log("NOW",byte); + if (l === 0) { byte = (byte & (~out) & 255); } + else { byte = (byte | out) & 255; } if (node.child !== null) { node.child.stdin.write(byte+"\n"); } else { node.warn("Command not running"); } } diff --git a/hardware/PiLiter/package.json b/hardware/PiLiter/package.json index 8b2f3228..ea7a7143 100644 --- a/hardware/PiLiter/package.json +++ b/hardware/PiLiter/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-piliter", - "version" : "0.0.10", + "version" : "0.0.11", "description" : "A Node-RED node to drive a Raspberry Pi Pi-LITEr 8 LED board.", "dependencies" : { },