mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
slight tidy to Arduino and bump version
This commit is contained in:
parent
f676005cad
commit
dc3b220ec4
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
Copyright 2013,2015 IBM Corp.
|
Copyright 2013,2016 IBM Corp.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@ -18,10 +18,6 @@
|
|||||||
<label for="node-input-arduino"><i class="fa fa-tasks"></i> Arduino</label>
|
<label for="node-input-arduino"><i class="fa fa-tasks"></i> Arduino</label>
|
||||||
<input type="text" id="node-input-arduino">
|
<input type="text" id="node-input-arduino">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-pin"><i class="fa fa-circle"></i> <span data-i18n="arduino.label.pin"></span></label>
|
|
||||||
<input type="text" id="node-input-pin" placeholder="2">
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-state"><i class="fa fa-wrench"></i> <span data-i18n="arduino.label.type"></span></label>
|
<label for="node-input-state"><i class="fa fa-wrench"></i> <span data-i18n="arduino.label.type"></span></label>
|
||||||
<select type="text" id="node-input-state" style="width: 150px;">
|
<select type="text" id="node-input-state" style="width: 150px;">
|
||||||
@ -30,6 +26,10 @@
|
|||||||
<option value="STRING" data-i18n="arduino.state.in.string"></option>
|
<option value="STRING" data-i18n="arduino.state.in.string"></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-pin"><i class="fa fa-circle"></i> <span data-i18n="arduino.label.pin"></span></label>
|
||||||
|
<input type="text" id="node-input-pin" placeholder="2">
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
|
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
|
||||||
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
|
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
|
||||||
@ -51,7 +51,10 @@
|
|||||||
color:"#3fadb5",
|
color:"#3fadb5",
|
||||||
defaults: {
|
defaults: {
|
||||||
name: {value:""},
|
name: {value:""},
|
||||||
pin: {value:"",required:true},
|
pin: {value:"",validate: function(v) {
|
||||||
|
var ct = $("#node-input-state").val() || this.state;
|
||||||
|
return ct === 'STRING' || (v != '');
|
||||||
|
}},
|
||||||
state: {value:"INPUT",required:true},
|
state: {value:"INPUT",required:true},
|
||||||
arduino: {type:"arduino-board"}
|
arduino: {type:"arduino-board"}
|
||||||
},
|
},
|
||||||
@ -59,6 +62,7 @@
|
|||||||
outputs:1,
|
outputs:1,
|
||||||
icon: "arduino.png",
|
icon: "arduino.png",
|
||||||
label: function() {
|
label: function() {
|
||||||
|
if (this.state === "STRING") { return "String"; }
|
||||||
var a = "";
|
var a = "";
|
||||||
if (this.state === "ANALOG") { a = "A"; }
|
if (this.state === "ANALOG") { a = "A"; }
|
||||||
return this.name||"Pin: "+a+this.pin;
|
return this.name||"Pin: "+a+this.pin;
|
||||||
@ -74,10 +78,6 @@
|
|||||||
<label for="node-input-arduino"><i class="fa fa-tasks"></i> <span data-i18n="arduino.label.arduino"></span></label>
|
<label for="node-input-arduino"><i class="fa fa-tasks"></i> <span data-i18n="arduino.label.arduino"></span></label>
|
||||||
<input type="text" id="node-input-arduino">
|
<input type="text" id="node-input-arduino">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
|
||||||
<label for="node-input-pin"><i class="fa fa-circle"></i> <span data-i18n="arduino.label.pin"></span></label>
|
|
||||||
<input type="text" id="node-input-pin" placeholder="13">
|
|
||||||
</div>
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-state"><i class="fa fa-wrench"></i> <span data-i18n="arduino.label.type"></span></label>
|
<label for="node-input-state"><i class="fa fa-wrench"></i> <span data-i18n="arduino.label.type"></span></label>
|
||||||
<select type="text" id="node-input-state" style="width: 200px;">
|
<select type="text" id="node-input-state" style="width: 200px;">
|
||||||
@ -87,6 +87,10 @@
|
|||||||
<option value="STRING" data-i18n="arduino.state.out.string"></option>
|
<option value="STRING" data-i18n="arduino.state.out.string"></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-input-pin"><i class="fa fa-circle"></i> <span data-i18n="arduino.label.pin"></span></label>
|
||||||
|
<input type="text" id="node-input-pin" placeholder="13">
|
||||||
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
|
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
|
||||||
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
|
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
|
||||||
@ -108,7 +112,10 @@
|
|||||||
color:"#3fadb5",
|
color:"#3fadb5",
|
||||||
defaults: {
|
defaults: {
|
||||||
name: {value:""},
|
name: {value:""},
|
||||||
pin: {value:"",required:false},
|
pin: {value:"",validate: function(v) {
|
||||||
|
var ct = $("#node-input-state").val() || this.state;
|
||||||
|
return ct === 'STRING' || (v != '');
|
||||||
|
}},
|
||||||
state: {value:"",required:true},
|
state: {value:"",required:true},
|
||||||
arduino: {type:"arduino-board"}
|
arduino: {type:"arduino-board"}
|
||||||
},
|
},
|
||||||
@ -117,6 +124,7 @@
|
|||||||
icon: "arduino.png",
|
icon: "arduino.png",
|
||||||
align: "right",
|
align: "right",
|
||||||
label: function() {
|
label: function() {
|
||||||
|
if (this.state === "STRING") { return "String"; }
|
||||||
return this.name||"Pin: "+this.pin;
|
return this.name||"Pin: "+this.pin;
|
||||||
},
|
},
|
||||||
labelStyle: function() {
|
labelStyle: function() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013,2015 IBM Corp.
|
* Copyright 2013,2016 IBM Corp.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -23,7 +23,7 @@ details and examples of how to use this node.
|
|||||||
|
|
||||||
Connects to local Arduino and monitors the selected pin for changes.
|
Connects to local Arduino and monitors the selected pin for changes.
|
||||||
|
|
||||||
You can select either **Digital** or **Analogue** input type.
|
You can select either **Digital**, **Analogue**, or **String** input type.
|
||||||
Outputs the value read as `msg.payload` and the pin number as `msg.topic`.
|
Outputs the value read as `msg.payload` and the pin number as `msg.topic`.
|
||||||
|
|
||||||
It only outputs on a change of value - fine for digital inputs, but you can get a lot of data from analogue pins which you must then handle.
|
It only outputs on a change of value - fine for digital inputs, but you can get a lot of data from analogue pins which you must then handle.
|
||||||
@ -39,6 +39,7 @@ You can select
|
|||||||
- **Digital** - accepts 0, 1, true, false, on, off
|
- **Digital** - accepts 0, 1, true, false, on, off
|
||||||
- **Analogue** (PWM) - accepts Integer 0 to 255
|
- **Analogue** (PWM) - accepts Integer 0 to 255
|
||||||
- **Servo** - accepts Integer 0 - 180
|
- **Servo** - accepts Integer 0 - 180
|
||||||
|
- **String** - to send a *String* to the Arduino
|
||||||
|
|
||||||
Expects a numeric value in `msg.payload`. The pin number is set in the properties panel.
|
Expects a numeric value in `msg.payload`. The pin number is set in the properties panel.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user