1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/hardware/PiFace
Sam Machin 2d28a2304f
Update package.jsons for mono-repo (#851)
Update the package.json for each node to point to the directory within the repo that hosts the code for the package in question.  as per https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository
2021-11-02 15:22:30 +00:00
..
37-rpi-piface.html cleanup some old x-red label - no new node versions 2021-03-13 14:25:45 +00:00
37-rpi-piface.js Update licenses and packages for all nodes 2016-11-06 20:26:19 +00:00
LICENSE Update licenses and packages for all nodes 2016-11-06 20:26:19 +00:00
package.json Update package.jsons for mono-repo (#851) 2021-11-02 15:22:30 +00:00
README.md update hardware nodes info style 2016-03-02 13:27:52 +00:00

node-red-node-piface

Node-RED nodes to control a PiFace Digital add-on board for a Raspberry-Pi.

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.

Install

Run the following command in your Node-RED user directory - typically ~/.node-red

npm install node-red-node-piface

Pre-reqs

Device Tree must be turned off. To do this run

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 WiringPi site 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

Usage

A pair of input and output Node-RED nodes for the Raspberry Pi PiFace Digital add-on board.

Output

The PiFace output node will set the selected relay, LED, or pin on or off depending on the value passed in. Expects a msg.payload with either a 1 or 0 (or true or false).

Requires the WiringPi gpio command in order to work (see pre-reqs).

Input

The PiFace input node generates a msg.payload with either a 0 or 1 depending on the state of the input pin.

You may also enable the input pullup resistor if required.

The msg.topic is set to piface/{the pin number}

Requires the WiringPi gpio command in order to work (see pre-reqs).

Note: This node currently polls the pin every 250mS. This is not ideal as it loads the cpu.