UNPKG

node-red-contrib-grove-sensors-edison

Version:

A Node-RED node to interface with some grove sensors

70 lines (63 loc) 2.87 kB
<!-- Copyright 2015 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/javascript"> RED.nodes.registerType('grove_temp',{ category: 'Intel gpio', color: '#a6bbcf', paletteLabel: 'grove temp sensor', defaults: { name: {value:""}, pin: {value:"", required: true, validate:RED.validators.number()}, interval: {value:"100", required: true, validate:RED.validators.number()} }, inputs:0, outputs:1, icon: "arrow.png", label: function() { return this.name||"Temp"+this.pin; }, oneditprepare: function() { var pinnow = this.pin; $.getJSON('mraa-version/'+this.id,function(data) { $('#ver-tip').text(data); }); } }); </script> <script type="text/x-red" data-template-name="grove_temp"> <div class="form-row"> <label for="node-input-pin"><i class="fa fa-circle"></i> Pin</label> <select type="text" id="node-input-pin" style="width:250px;"> <option value='' disabled selected style='display:none;'><span data-i18n="rpi-gpio.label.selectpin"></span></option> <option value="0">A0</option> <option value="1">A1</option> <option value="2">A2</option> <option value="3">A3</option> <option value="4">A4</option> <option value="5">A5</option> </select> </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-clock-o"></i> Interval</label> <input type="text" id="node-input-interval" placeholder="Interval" style="width:250px;"> mS </div> <div class="form-row"> <label for="node-input-name"><i class="fa fa-tag"></i> Name</label> <input type="text" id="node-input-name" placeholder="Name" style="width: 250px;"> </div> <div class="form-tips">Board : <span id="btype">n/a</span><br/>mraa version : <span id="ver-tip">n/a</span></div> </script> <script type="text/x-red" data-help-name="grove_temp"> <p>A Grove Temperature Sensor attached to the pin specified taking a reading every <i>interval</i> milliseconds.</p> <p>The <b>msg.payload</b> will contain the value.</p> </script>