2016-01-11 22:22:30 +01:00
|
|
|
|
2020-12-12 15:26:31 +01:00
|
|
|
<script type="text/html" data-template-name="rpi-neopixels">
|
2016-01-11 22:22:30 +01:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-pixels"><i class="fa fa-sun-o"></i> LEDs</label>
|
|
|
|
<input type="text" id="node-input-pixels" placeholder="number" style="width:60px;"> in the string
|
2020-12-12 15:26:31 +01:00
|
|
|
<span style="margin-left:50px;">Pin Number </span>
|
|
|
|
<select id="node-input-gpio" style="width:50px; margin-left:5px;">
|
|
|
|
<option value="18">12</option>
|
|
|
|
<option value="12">32</option>
|
|
|
|
<option value="13">33</option>
|
|
|
|
<option value="19">35</option>
|
|
|
|
</select>
|
2016-01-11 22:22:30 +01:00
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-mode"><i class="fa fa-cogs"></i> Mode</label>
|
|
|
|
<select id="node-input-mode" style="width:73%">
|
2016-01-13 20:59:30 +01:00
|
|
|
<option value="pcent">Bar - Percent of length</option>
|
|
|
|
<option value="pixels">Bar - Number of pixels</option>
|
|
|
|
<option value="pcentneedle">Needle - Percent of length</option>
|
|
|
|
<option value="pixelsneedle">Needle - Number of pixels</option>
|
2016-01-12 23:53:43 +01:00
|
|
|
<option value="shiftu">Add pixel to start</option>
|
|
|
|
<option value="shiftd">Add pixel to end</option>
|
2016-01-11 22:22:30 +01:00
|
|
|
</select>
|
|
|
|
</div>
|
2016-01-13 22:21:17 +01:00
|
|
|
<div class="form-row" id="bgcol">
|
|
|
|
<label for="node-input-bgnd"><i class="fa fa-picture-o"></i> Background</label>
|
|
|
|
<input type="text" id="node-input-bgnd" placeholder="HTML colour name or rrr,ggg,bbb">
|
|
|
|
</div>
|
|
|
|
<div class="form-row" id="fgcol">
|
|
|
|
<label for="node-input-fgnd"><i class="fa fa-picture-o"></i> Foreground</label>
|
|
|
|
<input type="text" id="node-input-fgnd" placeholder="HTML colour name or rrr,ggg,bbb">
|
|
|
|
</div>
|
2016-01-11 22:22:30 +01:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-wipe"><i class="fa fa-clock-o"></i> Wipe time</label>
|
2016-01-29 21:08:30 +01:00
|
|
|
<input type="text" id="node-input-wipe" placeholder="number" style="width:60px;"> mS Pixel order
|
|
|
|
<select id="node-input-rgb" style="width:80px">
|
|
|
|
<option value="rgb">RGB</option>
|
|
|
|
<option value="grb">GRB</option>
|
|
|
|
</select>
|
2016-01-11 22:22:30 +01:00
|
|
|
</div>
|
2018-04-15 00:17:12 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-brightness"><i class="fa fa-sun-o"></i> Brightness</label>
|
|
|
|
<input type="text" id="node-input-brightness" placeholder="number" style="width:60px;"> (0-100)
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-gamma"> </label>
|
|
|
|
<label for="node-input-gamma" style="width:70%">
|
|
|
|
<input type="checkbox" id="node-input-gamma" style="display:inline-block; width:22px; vertical-align:baseline;"> Apply gamma correction
|
|
|
|
</label>
|
|
|
|
</div>
|
2016-01-11 22:22:30 +01:00
|
|
|
<br/>
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
|
|
<input type="text" id="node-input-name">
|
|
|
|
</div>
|
2020-12-12 18:18:18 +01:00
|
|
|
<div class="form-tips"><b>Note</b>: pins 12 and 32 are on channel 0, and 33 and 35 are on channel 1.
|
|
|
|
You can only use one pin from each channel.</div>
|
2016-01-11 22:22:30 +01:00
|
|
|
</script>
|
|
|
|
|
2020-12-12 15:26:31 +01:00
|
|
|
<script type="text/html" data-help-name="rpi-neopixels">
|
2016-01-11 22:22:30 +01:00
|
|
|
<p>Raspberry Pi node to drive a string of neopixel or ws2812 LEDs.</p>
|
|
|
|
<p>Defaults to a bar chart style mode using configured foreground and background colours.
|
2016-01-13 20:59:30 +01:00
|
|
|
It can also display a needle (single pixel) type gauge.</p>
|
2016-02-12 22:27:02 +01:00
|
|
|
<p>It can accept a number in <code>msg.payload</code> that can be either the
|
2016-01-13 20:59:30 +01:00
|
|
|
number of pixels, or a percentage of the total length.</p>
|
2016-01-11 22:22:30 +01:00
|
|
|
<p>If you want to change the foregound colour, you can send a CSV of <i>html colour,length</i>.</p>
|
|
|
|
<p>To set the background just send an <i>html colour</i> name.
|
|
|
|
<a href="http://html-color-codes.info/color-names/" target="_top">Here
|
|
|
|
is a list</a> of html colour names.<p>
|
2016-01-12 23:53:43 +01:00
|
|
|
<p>You can also select shift modes where a single colour pixel is added to either the start or the end of the strip.</p>
|
2016-02-12 22:27:02 +01:00
|
|
|
<p>The <i>nth</i> pixel is set by <code>msg.payload</code> with a CSV string <i>n,r,g,b</i>
|
|
|
|
<!-- <p>The whole strip is set by <code>msg.payload</code> with a CSV string <i>r,g,b</i> -->
|
|
|
|
<p>A range of pixels from <i>x</i> to <i>y</i> can be set by <code>msg.payload</code>
|
2016-01-11 22:22:30 +01:00
|
|
|
with a CSV string <i>x,y,r,g,b</i>
|
2018-04-15 00:17:12 +02:00
|
|
|
<p>By default, gamma correction is enabled but it can disabled which can be useful for working with low brightness levels</p>
|
|
|
|
<p><code>msg.brightness</code> can be used to dynamically set brightness level</p>
|
2020-12-12 18:18:18 +01:00
|
|
|
<p>The pixels data line should be connected to Pi physical pin 12, 32, 33 or 35. <b>Note:</b>
|
|
|
|
pins 12 and 32 are on the same channel, as are 33 and 35. If you want connect two neopixels then use pins
|
|
|
|
from different channels.</p>
|
|
|
|
<p>Note: this node may also conflict with audio playback.</p>
|
2016-01-18 14:06:38 +01:00
|
|
|
<p align="right"><a href="http://flows.nodered.org/node/node-red-node-pi-neopixel#usage">More info </a></p>
|
2016-01-11 22:22:30 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
RED.nodes.registerType('rpi-neopixels',{
|
|
|
|
category: 'Raspberry Pi',
|
|
|
|
color:"#c6dbef",
|
|
|
|
defaults: {
|
|
|
|
name: { value:"" },
|
2020-12-12 15:26:31 +01:00
|
|
|
gpio: { value:18 },
|
2016-01-11 22:22:30 +01:00
|
|
|
pixels: { value:"", required:true, validate:RED.validators.number() },
|
|
|
|
bgnd: { value:"" },
|
|
|
|
fgnd: { value:"" },
|
|
|
|
wipe: { value:"40", required:true, validate:RED.validators.number() },
|
2016-01-29 21:08:30 +01:00
|
|
|
mode: { value:"pcent" },
|
2018-04-15 00:17:12 +02:00
|
|
|
rgb: { value:"rgb" },
|
|
|
|
brightness: { value:"100", required:true, validate:RED.validators.number() },
|
|
|
|
gamma: { value: true }
|
2016-01-11 22:22:30 +01:00
|
|
|
},
|
|
|
|
inputs:1,
|
|
|
|
outputs:0,
|
|
|
|
icon: "rpi.png",
|
|
|
|
align: "right",
|
|
|
|
label: function() {
|
|
|
|
return this.name||this.pixels+" neopixels";
|
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
2016-01-13 22:21:17 +01:00
|
|
|
},
|
|
|
|
oneditprepare: function() {
|
2018-04-15 00:17:12 +02:00
|
|
|
if (this.gamma === undefined) {
|
|
|
|
this.gamma = true;
|
|
|
|
$("#node-input-gamma").prop('checked', true);
|
|
|
|
}
|
|
|
|
if (this.brightness === undefined) {
|
|
|
|
this.brighness = "100";
|
|
|
|
$("#node-input-brightness").val("100");
|
|
|
|
}
|
2016-01-13 22:21:17 +01:00
|
|
|
var setstate = function () {
|
|
|
|
if ($('#node-input-mode').val().indexOf("shift") !== -1) {
|
|
|
|
$("#bgcol").hide();
|
|
|
|
$("#fgcol").hide();
|
|
|
|
} else {
|
|
|
|
$("#bgcol").show();
|
|
|
|
$("#fgcol").show();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
$("#node-input-mode").change(function () { setstate(); });
|
|
|
|
setstate();
|
2016-01-11 22:22:30 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|