mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
parent
76a221919a
commit
88f7f52f99
@ -6,8 +6,9 @@
|
|||||||
</div>
|
</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:200px;">
|
||||||
<option value="INPUT" data-i18n="arduino.state.in.digital"></option>
|
<option value="INPUT" data-i18n="arduino.state.in.digital"></option>
|
||||||
|
<option value="PULLUP" data-i18n="arduino.state.in.pullup"></option>
|
||||||
<option value="ANALOG" data-i18n="arduino.state.in.analogue"></option>
|
<option value="ANALOG" data-i18n="arduino.state.in.analogue"></option>
|
||||||
<option value="STRING" data-i18n="arduino.state.in.string"></option>
|
<option value="STRING" data-i18n="arduino.state.in.string"></option>
|
||||||
</select>
|
</select>
|
||||||
@ -66,7 +67,7 @@
|
|||||||
</div>
|
</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;">
|
||||||
<option value="OUTPUT" data-i18n="arduino.state.out.digital"></option>
|
<option value="OUTPUT" data-i18n="arduino.state.out.digital"></option>
|
||||||
<option value="PWM" data-i18n="arduino.state.out.analogue"></option>
|
<option value="PWM" data-i18n="arduino.state.out.analogue"></option>
|
||||||
<option value="SERVO" data-i18n="arduino.state.out.servo"></option>
|
<option value="SERVO" data-i18n="arduino.state.out.servo"></option>
|
||||||
|
@ -78,6 +78,15 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (node.state === "PULLUP") {
|
||||||
|
node.board.pinMode(node.pin, 0x0B);
|
||||||
|
node.board.digitalRead(node.pin, function(v) {
|
||||||
|
if (v !== node.oldval) {
|
||||||
|
node.oldval = v;
|
||||||
|
node.send({payload:v, topic:node.pin});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
if (node.state == "STRING") {
|
if (node.state == "STRING") {
|
||||||
node.board.on('string', function(v) {
|
node.board.on('string', function(v) {
|
||||||
if (v !== node.oldval) {
|
if (v !== node.oldval) {
|
||||||
|
@ -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**, **Analogue**, or **String** input type.
|
You can select either **Digital**, **Pullup**, **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. For example you could use a `delay` node set to rate limit and drop intermediate values, or an `rbe` node to only report when it changes by a certain amount.
|
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. For example you could use a `delay` node set to rate limit and drop intermediate values, or an `rbe` node to only report when it changes by a certain amount.
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"in": {
|
"in": {
|
||||||
"digital": "Digital pin",
|
"digital": "Digital pin",
|
||||||
|
"pullup": "Digital pin with pullup",
|
||||||
"analogue": "Analogue pin",
|
"analogue": "Analogue pin",
|
||||||
"string": "String"
|
"string": "String"
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-arduino",
|
"name" : "node-red-node-arduino",
|
||||||
"version" : "0.0.17",
|
"version" : "0.0.18",
|
||||||
"description" : "A Node-RED node to talk to an Arduino running firmata",
|
"description" : "A Node-RED node to talk to an Arduino running firmata",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"firmata" : "~0.19.1"
|
"firmata" : "~0.19.1"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user