mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
8bf813c9cd
Make the colours the same as the RPi equivalents. Remove ‘BBB’ from the node names. Further debug output
73 lines
3.0 KiB
HTML
73 lines
3.0 KiB
HTML
<!--
|
|
Copyright 2014 Maxwell R Hadley
|
|
|
|
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.
|
|
-->
|
|
|
|
<!-- Define the edit dialog -->
|
|
<script type="text/x-red" data-template-name="analog-in">
|
|
<div class="form-row">
|
|
<label for="node-input-pin"><i class="icon-asterisk"></i>Input pin</label>
|
|
<select type="text" id="node-input-pin" style="width: 150px;">
|
|
<option value="">select pin</option>
|
|
<option value="P9_39">AIN0 (P9 pin 39)</option>
|
|
<option value="P9_40">AIN1 (P9 pin 40)</option>
|
|
<option value="P9_37">AIN2 (P9 pin 37)</option>
|
|
<option value="P9_38">AIN3 (P9 pin 38)</option>
|
|
<option value="P9_33">AIN4 (P9 pin 33)</option>
|
|
<option value="P9_36">AIN5 (P9 pin 36)</option>
|
|
<option value="P9_35">AIN6 (P9 pin 35)</option>
|
|
</select>
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-topic"><i class="icon-tasks"></i> Topic</label>
|
|
<input type="text" id="node-input-topic" placeholder="Topic">
|
|
</div>
|
|
<div class="form-row">
|
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
</div>
|
|
</script>
|
|
|
|
<!-- Add help text -->
|
|
<script type="text/x-red" data-help-name="analog-in">
|
|
<p>
|
|
Analogue input for the Beaglebone Black. Reads an anlogue pin when triggered
|
|
</p>
|
|
<p>The output message topic is the node topic: the output message value is the
|
|
analogue input in the range [0-1), or NaN if an read error occurs (errors are logged)
|
|
</p>
|
|
</script>
|
|
|
|
<!-- Register the node -->
|
|
<script type="text/javascript">
|
|
RED.nodes.registerType('analog-in', {
|
|
category: 'advanced-input', // the palette category
|
|
color:"#c6dbef",
|
|
defaults: { // defines the editable properties of the node
|
|
name: { value:"" }, // along with default values.
|
|
topic: { value:"", required:true },
|
|
pin: { value:"", required:true },
|
|
},
|
|
inputs:1, // set the number of inputs - only 0 or 1
|
|
outputs:1, // set the number of outputs - 0 to n
|
|
icon: "arrow-in.png", // set the icon (held in public/icons)
|
|
label: function() { // sets the default label contents
|
|
return this.name || "analog-in: " + this.pin;
|
|
},
|
|
labelStyle: function() { // sets the class to apply to the label
|
|
return this.name ? "node_label_italic" : "";
|
|
}
|
|
});
|
|
</script>
|