diff --git a/hardware/LEDborg/78-ledborg.html b/hardware/LEDborg/78-ledborg.html
index 338e77d5..d7f809b8 100644
--- a/hardware/LEDborg/78-ledborg.html
+++ b/hardware/LEDborg/78-ledborg.html
@@ -19,13 +19,13 @@
-
Expects a msg.payload with PiBorg three digit rgb colour string. 000 -> 222
+ See info panel for the various input options.
diff --git a/hardware/PiFace/37-rpi-piface.js b/hardware/PiFace/37-rpi-piface.js
index 6083f259..b206f1cc 100644
--- a/hardware/PiFace/37-rpi-piface.js
+++ b/hardware/PiFace/37-rpi-piface.js
@@ -1,5 +1,5 @@
/**
- * Copyright 2013 IBM Corp.
+ * Copyright 2013,2014 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -63,6 +63,8 @@ module.exports = function(RED) {
this.npin = n.pin;
this.pin = pintable[n.pin];
this.intype = n.intype;
+ this.read = n.read || false;
+ if (this.read) { this.buttonState = -2; }
var node = this;
if (node.pin) {
exec("gpio -p mode "+node.pin+" "+node.intype, function(err,stdout,stderr) {
@@ -99,6 +101,11 @@ module.exports = function(RED) {
this.pin = pintable[n.pin];
var node = this;
if (node.pin) {
+ if (node.set) {
+ exec("gpio -p write "+node.pin+" "+node.level, function(err,stdout,stderr) {
+ if (err) { node.error(err); }
+ });
+ }
node.on("input", function(msg) {
if (msg.payload === "true") { msg.payload = true; }
if (msg.payload === "false") { msg.payload = false; }
diff --git a/hardware/PiFace/package.json b/hardware/PiFace/package.json
index b98f08ba..784de5c1 100644
--- a/hardware/PiFace/package.json
+++ b/hardware/PiFace/package.json
@@ -1,6 +1,6 @@
{
"name" : "node-red-node-piface",
- "version" : "0.0.1",
+ "version" : "0.0.2",
"description" : "Node-RED nodes to read from and write to a PiFace Digital Raspberry Pi add-on board",
"dependencies" : {
},
diff --git a/hardware/PiLiter/39-rpi-piliter.html b/hardware/PiLiter/39-rpi-piliter.html
index 0fbc3385..c335c379 100644
--- a/hardware/PiLiter/39-rpi-piliter.html
+++ b/hardware/PiLiter/39-rpi-piliter.html
@@ -16,8 +16,9 @@
diff --git a/hardware/Pibrella/38-rpi-pibrella.js b/hardware/Pibrella/38-rpi-pibrella.js
index eaa8c96e..1ee55643 100644
--- a/hardware/Pibrella/38-rpi-pibrella.js
+++ b/hardware/Pibrella/38-rpi-pibrella.js
@@ -66,6 +66,8 @@ module.exports = function(RED) {
RED.nodes.createNode(this,n);
this.buttonState = -1;
this.pin = pintable[n.pin];
+ this.read = n.read || false;
+ if (this.read) { this.buttonState = -2; }
var node = this;
if (node.pin) {
@@ -102,6 +104,8 @@ module.exports = function(RED) {
function PibrellaOut(n) {
RED.nodes.createNode(this,n);
this.pin = pintable[n.pin];
+ this.set = n.set || false;
+ this.level = n.level || 0;
var node = this;
if (node.pin == "1") {
@@ -123,23 +127,26 @@ module.exports = function(RED) {
});
}
else if (node.pin) {
- process.nextTick(function() {
- exec("gpio mode "+node.pin+" out", function(err,stdout,stderr) {
- if (err) { node.error(err); }
- else {
- node.on("input", function(msg) {
- if (msg.payload === "true") { msg.payload = true; }
- if (msg.payload === "false") { msg.payload = false; }
- var out = Number(msg.payload);
- if ((out === 0)|(out === 1)) {
- exec("gpio write "+node.pin+" "+out, function(err,stdout,stderr) {
- if (err) { node.error(err); }
- });
- }
- else { node.warn("Invalid input - not 0 or 1"); }
+ exec("gpio mode "+node.pin+" out", function(err,stdout,stderr) {
+ if (err) { node.error(err); }
+ else {
+ if (node.set) {
+ exec("gpio write "+node.pin+" "+node.level, function(err,stdout,stderr) {
+ if (err) { node.error(err); }
});
}
- });
+ node.on("input", function(msg) {
+ if (msg.payload === "true") { msg.payload = true; }
+ if (msg.payload === "false") { msg.payload = false; }
+ var out = Number(msg.payload);
+ if ((out === 0)|(out === 1)) {
+ exec("gpio write "+node.pin+" "+out, function(err,stdout,stderr) {
+ if (err) { node.error(err); }
+ });
+ }
+ else { node.warn("Invalid input - not 0 or 1"); }
+ });
+ }
});
}
else {
diff --git a/hardware/Pibrella/package.json b/hardware/Pibrella/package.json
index 69dc32e2..348b5a6b 100644
--- a/hardware/Pibrella/package.json
+++ b/hardware/Pibrella/package.json
@@ -1,6 +1,6 @@
{
"name" : "node-red-node-pibrella",
- "version" : "0.0.2",
+ "version" : "0.0.3",
"description" : "A Node-RED node to read from and write to a Pibrella Raspberry Pi add-on board",
"dependencies" : {
},