mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Tiny tweaks to PiFace UI language
This commit is contained in:
parent
5782a4ee85
commit
8bfb483091
@ -52,10 +52,11 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="rpi-piface in">
|
<script type="text/x-red" data-help-name="rpi-piface in">
|
||||||
<p>Raspberry Pi PiFace input node. Generates a <b>msg.payload</b> with either a 0 or 1 depending on the state of the input pin. Requires the gpio command to work.</p>
|
<p>Raspberry Pi PiFace input node. Generates a <b>msg.payload</b> with either a 0 or 1 depending on the state of the input pin.</p>
|
||||||
<p>You may also enable the input pullup resitor if required.</p>
|
<p>You may also enable the input pullup resistor if required.</p>
|
||||||
<p>The <b>msg.topic</b> is set to <i>pi/{the pin number}</i></p>
|
<p>The <b>msg.topic</b> is set to <i>piface/{the pin number}</i></p>
|
||||||
<p><b>Note:</b> This node currently polls the pin every 250mS. This is not ideal as it loads the cpu, and will be rewritten shortly to try to use interrupts.</p>
|
<p>Requires the WiringPi gpio command in order to work.</p>
|
||||||
|
<p><b>Note:</b> This node currently polls the pin every 250mS. This is not ideal as it loads the cpu.</p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -103,9 +104,9 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="rpi-piface out">
|
<script type="text/x-red" data-help-name="rpi-piface out">
|
||||||
<p>Raspberry Pi PiFace output node. The PiFace board must be fitted. Requires the gpio command to work.</p>
|
<p>Raspberry Pi PiFace output node. The PiFace board must be fitted.</p>
|
||||||
<p>Expects a <b>msg.payload</b> with either a 0 or 1 (or true or false).</p>
|
<p>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).</p>
|
||||||
<p>Will set the selected relay, LED, or pin on or off depending on the value passed in.</p>
|
<p>Requires the WiringPi gpio command in order to work.</p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -57,6 +57,33 @@ var pintable = {
|
|||||||
"LED 6":"206",
|
"LED 6":"206",
|
||||||
"LED 7":"207"
|
"LED 7":"207"
|
||||||
}
|
}
|
||||||
|
var tablepin = {
|
||||||
|
// WiringPi : Physical
|
||||||
|
"200":"S1",
|
||||||
|
"201":"S2",
|
||||||
|
"202":"S3",
|
||||||
|
"203":"S4",
|
||||||
|
"204":"I5",
|
||||||
|
"205":"I6",
|
||||||
|
"206":"I7",
|
||||||
|
"207":"I8",
|
||||||
|
"208":"O0",
|
||||||
|
"209":"O1",
|
||||||
|
"210":"O2",
|
||||||
|
"211":"O3",
|
||||||
|
"212":"O4",
|
||||||
|
"213":"O5",
|
||||||
|
"214":"O6",
|
||||||
|
"215":"O7",
|
||||||
|
"200":"L0",
|
||||||
|
"201":"L1",
|
||||||
|
"202":"L2",
|
||||||
|
"203":"L3",
|
||||||
|
"204":"L4",
|
||||||
|
"205":"L5",
|
||||||
|
"206":"L6",
|
||||||
|
"207":"L7"
|
||||||
|
}
|
||||||
|
|
||||||
function PiFACEInNode(n) {
|
function PiFACEInNode(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
@ -76,7 +103,7 @@ function PiFACEInNode(n) {
|
|||||||
var previousState = node.buttonState;
|
var previousState = node.buttonState;
|
||||||
node.buttonState = Number(stdout);
|
node.buttonState = Number(stdout);
|
||||||
if (previousState !== -1) {
|
if (previousState !== -1) {
|
||||||
var msg = {topic:"pi/"+node.pin, payload:node.buttonState};
|
var msg = {topic:"piface/"+tablepin[node.pin], payload:node.buttonState};
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user