node-red-nodes/hardware/HummingboardGPIO/README.md

46 lines
1.6 KiB
Markdown
Raw Normal View History

2014-12-10 10:29:18 +01:00
node-red-node-hbgpio
====================
A <a href="http://nodered.org" target="_new">Node-RED</a> node to read and write the digital IO of a SolidRun HummingBoard.
Install
-------
2014-12-10 18:52:33 +01:00
**This install is for Debian based OS on Hummingboard.**
2016-03-02 14:25:52 +01:00
Run the following command in your Node-RED user directory - typically `~/.node-red`
2014-12-10 10:29:18 +01:00
npm install node-red-node-hpgpio
**Note :** This **should** be run as root in order to move and set SUID permissions on a script to talk to the gpio pins. Alternatively you can run as a normal user and then move the file and change permissions manually.
sudo cp node_modules/node-red-node-hpgpio/gpiohb /usr/local/bin/
2016-03-02 14:25:52 +01:00
sudo chmod 4755 /usr/local/bin/gpiohb
2014-12-10 10:29:18 +01:00
Usage
-----
Hummingboard GPIO input and output nodes.
This requires a small script (gpiohb) to run as root in order to work. It should be placed in /usr/local/bin/ and have SUID permissions 4755.
**Note:** We are using the actual physical pin numbers as they are easier to locate.
2016-03-02 14:25:52 +01:00
### Output node
2014-12-10 10:29:18 +01:00
2016-03-02 14:25:52 +01:00
Expects a `msg.payload` with either a 0 or 1 (or true or false).
2014-12-10 10:29:18 +01:00
Will set the selected physical pin high or low depending on the value passed in.
The initial value of the pin at deploy time can also be set to 0 or 1.
2016-03-02 14:25:52 +01:00
### Input node
2014-12-10 10:29:18 +01:00
2016-03-02 14:25:52 +01:00
Generates a `msg.payload` with either a 0 or 1 depending on the state of the input pin.
2014-12-10 10:29:18 +01:00
2016-03-02 14:25:52 +01:00
The `msg.topic` is set to *pin/{the pin number}*
2014-12-10 10:29:18 +01:00
**Note:** The input node waits for a change on the level of the pin before reading the value - and then resets to wait for the next interrupt - so it is possible to miss very fast changes as we may still be reading the value when the second edge occurs.