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/unicorn/unicorn.html

71 lines
3.0 KiB
HTML
Raw Normal View History

2016-01-11 22:21:54 +01:00
<!--
Copyright 2016 IBM Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<script type="text/x-red" data-template-name="rpi-unicorn">
<div class="form-row">
<label for="node-input-png"><i class="fa fa-picture-o"></i> Background</label>
<input type="text" id="node-input-png" placeholder="8 x 8 pixel png file or rrr,ggg,bbb">
</div>
<div class="form-row">
<label for="node-input-bright"><i class="fa fa-sun-o"></i> Brightness</label>
<input type="text" id="node-input-bright" placeholder="0 to 100, default 20" style="width:150px;"> %
</div>
<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>
</script>
<script type="text/x-red" data-help-name="rpi-unicorn">
<p>Raspberry Pi Unicorn HAT Node</p>
<p>The background of the array can be configured using an 8x8 pixel sized
png image, or by specifying a single colour using an <i>r,g,b</i> triple.</p>
<p>The background colour can also be set by a <code>msg.payload</code> with an <i>r,g,b</i> triple.</p>
<p>A pixel is set by a <code>payload</code> containing a CSV string <i>x,y,r,g,b</i> .
Multiple pixels strings can also be sent as <i>x1,y1,r1,g1,b1,x2,y2,r2,g2,b2,...</i> .
2016-01-11 22:21:54 +01:00
If x or y are set to * then the complete row or column can be set.</p>
<p>Any msg with a <code>topic</code> identifies a 'sprite', which can then
be moved independently. A 'sprite' can be a single pixel or a group of pixels.</p>
<p>Setting <code>payload</code> to 0 will delete the sprite from the list.</p>
<p>Setting <code>payload</code> to "CLS" will clear the display to off and delete any sprites.</p>
<p>Setting <code>payload</code> to "DEL" will delete any sprites, and leave the background.</p>
<p>The brightness may be set by setting <code>payload</code> to <i>brightness,nn</i> where nn is 0 to 100.</p>
<p>The rotation may be set by setting <code>payload</code> to <i>rotate,rr</i> where rr is 0, 90, 180 or 270.</p>
2016-01-11 22:21:54 +01:00
</script>
<script type="text/javascript">
RED.nodes.registerType('rpi-unicorn',{
category: 'Raspberry Pi',
color:"#c6dbef",
defaults: {
name: { value:"" },
png: { value:"" },
bright: { value:"" }
},
inputs:1,
outputs:0,
icon: "rpi.png",
align: "right",
label: function() {
return this.name||"unicorn hat";
},
labelStyle: function() {
return this.name?"node_label_italic":"";
}
});
</script>