mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Make LEDborg use more clear,
warn if more than one deployed at a time.
This commit is contained in:
parent
ddacd61ab0
commit
439a890688
@ -19,7 +19,8 @@
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-tips">See info panel for the various input options.</div>
|
||||
<div class="form-tips">Uses pins 11, 13 aand 15.<br/>
|
||||
See info panel for the various input options and limitations.</div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="ledborg">
|
||||
@ -29,6 +30,8 @@
|
||||
<p>You can also use the @cheerlight colour names - red, amber, green, blue,
|
||||
cyan, magenta, yellow, orange, pink, purple, white, warmwhite, black</p>
|
||||
<p>You may also supply a comma separated rrr,ggg,bbb where each value can be between 0 and 255.</p>
|
||||
<p>You can only use one LEDborg node per flow... but you may wire multiple things to it.</p>
|
||||
<p><b>Note</b> : This node uses physical pins 11, 13, and 15. These cannot be used for anything else while this node is in use.</p>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
@ -20,6 +20,7 @@ module.exports = function(RED) {
|
||||
//var exec = require('child_process').exec;
|
||||
var spawn = require('child_process').spawn;
|
||||
var fs = require('fs');
|
||||
var LedBorgInUse = false;
|
||||
|
||||
var gpioCommand = __dirname+'/nrgpio';
|
||||
|
||||
@ -42,6 +43,8 @@ module.exports = function(RED) {
|
||||
|
||||
function LedBorgNode(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
if (LedBorgInUse) { this.error("LEDborg node already in use - you may only have one."); }
|
||||
else { LedBorgInUse = true; }
|
||||
this.pin = n.pin;
|
||||
this.set = n.set || false;
|
||||
this.level = n.level || 0;
|
||||
@ -120,6 +123,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
|
||||
node.on("close", function(done) {
|
||||
LedBorgInUse = false;
|
||||
node.status({fill:"red",shape:"circle",text:""});
|
||||
if (node.child != null) {
|
||||
node.done = done;
|
||||
|
@ -1,14 +1,15 @@
|
||||
node-red-node-ledborg
|
||||
=====================
|
||||
|
||||
A <a href="http://nodered.org" target="_new">Node-RED</a> node to control a <a href="https://www.piborg.org/ledborg" target="_new">PiBorg LedBorg</a> baord for a Raspberry Pi.
|
||||
A <a href="http://nodered.org" target="_new">Node-RED</a> node to control a <a href="https://www.piborg.org/ledborg" target="_new">PiBorg LedBorg</a> board for a Raspberry Pi.
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
Run the following command in the root directory of your Node-RED install
|
||||
Run the following command in the root directory of your Node-RED install,
|
||||
this is usually `~/.node-red`
|
||||
|
||||
npm install node-red-node-ledborg
|
||||
npm i node-red-node-ledborg
|
||||
|
||||
|
||||
Usage
|
||||
@ -23,3 +24,11 @@ You can also now use a <b>msg.payload</b> in the standard hex format "#rrggbb".
|
||||
><pre>0x00 - 0x57 = off<br/>0x58 - 0xA7 = 50%<br/>0xA8 - 0xFF = fully on</pre>
|
||||
|
||||
You can also use the @cheerlight colour names - red, amber, green, blue, cyan, magenta, yellow, orange, pink, purple, white, warmwhite, black
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
This node can only be used once per flow... as it uses physical pins 11, 13 and 15 on the Pi.
|
||||
Using it more than once will cause weird flashing and unpredictable behaviour.
|
||||
|
||||
You can of course wire up multiple things in your flow to the same LEDborg node.
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-ledborg",
|
||||
"version" : "0.0.9",
|
||||
"version" : "0.0.10",
|
||||
"description" : "A Node-RED node to control a PiBorg LedBorg board for a Raspberry Pi.",
|
||||
"dependencies" : {
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user