2014-07-08 23:57:42 +02:00
|
|
|
node-red-node-piface
|
|
|
|
====================
|
|
|
|
|
2015-12-20 12:39:59 +01:00
|
|
|
<a href="http://nodered.org" target="_new">Node-RED</a> nodes to control a
|
|
|
|
<a href="http://www.piface.org.uk/products/piface_digital/" target="_new">PiFace Digital</a>
|
|
|
|
add-on board for a Raspberry-Pi.
|
2014-07-08 23:57:42 +02:00
|
|
|
|
2016-01-03 13:25:08 +01:00
|
|
|
**Note:** Some later versions of the PiFace relabelled the switch inputs to be `0 - 7`
|
|
|
|
instead of `1 - 8` as on the original boards.
|
|
|
|
We cannot automatically detect this so the user will have to apply some common sense.
|
|
|
|
|
2014-07-08 23:57:42 +02:00
|
|
|
Install
|
|
|
|
-------
|
|
|
|
|
|
|
|
Run the following command in the root directory of your Node-RED install
|
|
|
|
|
|
|
|
npm install node-red-node-piface
|
|
|
|
|
|
|
|
|
|
|
|
Pre-reqs
|
|
|
|
--------
|
|
|
|
|
2015-12-20 12:39:59 +01:00
|
|
|
Device Tree **must** be turned off. To do this run
|
2014-07-08 23:57:42 +02:00
|
|
|
|
2015-12-20 12:39:59 +01:00
|
|
|
sudo raspi-config
|
|
|
|
|
|
|
|
then select the `Advanced Options`, then `Device Tree`, and finally select `No`
|
|
|
|
and `OK`. You will then need to reboot.
|
|
|
|
|
|
|
|
It also requires the WiringPi gpio command to be installed in order to work.
|
|
|
|
See the <a href="http://wiringpi.com" target="new">WiringPi site</a>
|
|
|
|
for details on how to do this. The short version is...
|
|
|
|
|
|
|
|
sudo apt-get install git-core
|
|
|
|
git clone git://git.drogon.net/wiringPi
|
|
|
|
cd wiringPi
|
|
|
|
git pull origin
|
|
|
|
./build
|
2014-07-08 23:57:42 +02:00
|
|
|
|
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
2015-12-20 12:39:59 +01:00
|
|
|
A pair of input and output Node-RED nodes for the Raspberry Pi PiFace Digital
|
|
|
|
add-on board.
|
2014-07-08 23:57:42 +02:00
|
|
|
|
2015-12-20 12:39:59 +01:00
|
|
|
### Output
|
2014-07-08 23:57:42 +02:00
|
|
|
|
2015-12-20 12:39:59 +01:00
|
|
|
The PiFace output node will set the selected relay, LED, or pin on or off
|
|
|
|
depending on the value passed in. Expects a <b>msg.payload</b> with either a
|
|
|
|
1 or 0 (or true or false).
|
2014-07-08 23:57:42 +02:00
|
|
|
|
|
|
|
Requires the WiringPi gpio command in order to work (see pre-reqs).
|
|
|
|
|
2015-12-20 12:39:59 +01:00
|
|
|
### Input
|
2014-07-08 23:57:42 +02:00
|
|
|
|
2015-12-20 12:39:59 +01:00
|
|
|
The PiFace input node generates a <b>msg.payload</b> with either a 0 or 1
|
|
|
|
depending on the state of the input pin.
|
2014-07-08 23:57:42 +02:00
|
|
|
|
|
|
|
You may also enable the input pullup resistor if required.
|
|
|
|
|
|
|
|
The <b>msg.topic</b> is set to <i>piface/{the pin number}</i>
|
|
|
|
|
|
|
|
Requires the WiringPi gpio command in order to work (see pre-reqs).
|
|
|
|
|
2015-12-20 12:39:59 +01:00
|
|
|
<b>Note:</b> This node currently polls the pin every 250mS. This is not ideal
|
|
|
|
as it loads the cpu.
|