mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-12-26 23:16:47 +01:00
* tiny update to Firmata.js * A complete rewrite of Firmata/Arduino See changes for v1.2 - v1.3.3 : https://github.com/node-red/node-red-nodes/issues/920#issuecomment-2709252741 [Node-RED announcement of 1.3.3](https://discourse.nodered.org/t/announce-node-red-node-arduino-firmata-remastered-v1-3-3/96317) * Arduino v1.3.3 update See: https://discourse.nodered.org/t/announce-node-red-node-arduino-firmata-remastered-v1-3-3/96317 * v1.3.4-20250331 Fixed port-search. See: https://discourse.nodered.org/t/announce-node-red-node-arduino-firmata-remastered-v1-3-3/96317/4?u=pizzaprogram * v1.3.4-20250331 * update v1.3.4-20250331 delete comments Co-authored-by: PizzaProgram <info@pizzaprogram.hu>
This commit is contained in:
committed by
GitHub
parent
cc186ef14e
commit
60593f154c
@@ -1,4 +1,93 @@
|
||||
<!--
|
||||
This is THE board, which is running Firmata firmware. Tipically an Arduino or RPi-Pico
|
||||
-->
|
||||
|
||||
<script type="text/html" data-template-name="arduino-board">
|
||||
<div class="form-row">
|
||||
<div class="form-tips"><span data-i18n="[html]arduino.tip.search"></span></div>
|
||||
<label for="node-config-input-device"><i class="fa fa-random"></i> <span data-i18n="arduino.label.port"></span></label>
|
||||
<input type="text" id="node-config-input-device" style="width:60%;" data-i18n="[placeholder]arduino.placeholder.port"/>
|
||||
<a id="node-config-lookup-serial" class="red-ui-button"><i id="node-config-lookup-serial-icon" class="fa fa-search"></i></a>
|
||||
<div class="form-tips"><span data-i18n="[html]arduino.tip.port"></span></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="arduino.label.name"></span></label>
|
||||
<input type="text" id="node-config-input-name" style="width:60%;"/>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="form-tips"><span data-i18n="[html]arduino.tip.otherboards"></span></div>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-samplingInt"><i class="fa fa-circle"></i> <span data-i18n="arduino.label.samplingInt"></span></label>
|
||||
<input type="number" id="node-config-input-samplingInt" style="width:20%;" data-i18n="[placeholder]arduino.placeholder.samplingInt" min=10 max=65500 />
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-log2consol"><i class="icon-bookmark"></i>Log to console</label>
|
||||
<input type="checkbox" id="node-config-input-log2consol">
|
||||
<div class="form-tips"><span data-i18n="[html]arduino.tip.log2consol"></span></div>
|
||||
</div>
|
||||
<!-- arduino.tip.... strings are stored at: 35-arduino.json file -->
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('arduino-board', {
|
||||
category: 'config',
|
||||
defaults: {
|
||||
device : {value: "" , required: true },
|
||||
name : {value: "" , required: false},
|
||||
samplingInt: {value: 250 , required: false}, // will read analog inputs 4x / sec by default. Can be 19-65500
|
||||
log2consol : {value: false, required: false}
|
||||
},
|
||||
label: function() {
|
||||
if (this.name !== "") return this.name
|
||||
else return this.device || "firmata-board-" + this.id; // (bad naming :-( ) device should be: "port"
|
||||
},
|
||||
oneditprepare: function() {
|
||||
try {
|
||||
$("#node-config-input-device").autocomplete( "destroy" ); // Remove auto-complete functionality from an <input>.
|
||||
} catch(err) { };
|
||||
|
||||
$("#node-config-lookup-serial").click(async function() { // Board's serial port search function
|
||||
console.log("Serial Auto-search started.");
|
||||
$("#node-config-lookup-serial-icon").removeClass('fa-search').addClass('spinner');
|
||||
$("#node-config-lookup-serial").addClass('disabled');
|
||||
|
||||
try {
|
||||
$.getJSON('arduinoports', async function(data, data2) {
|
||||
console.log('Serial Auto-search found data: %o', data);
|
||||
console.log('Data2: %o', data2);
|
||||
|
||||
// UI Updates
|
||||
$("#node-config-lookup-serial-icon").removeClass('spinner').addClass('fa-search');
|
||||
$("#node-config-lookup-serial").removeClass('disabled');
|
||||
// Ensure ports is an array (fallback to empty array)
|
||||
ports = data || [];
|
||||
|
||||
$("#node-config-input-device").autocomplete({
|
||||
source: ports,
|
||||
minLength: 0,
|
||||
close: function(event, ui) {
|
||||
console.log("Serial Auto-search closing.");
|
||||
$("#node-config-input-device").autocomplete("destroy");
|
||||
}
|
||||
}).autocomplete("search", "");
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error fetching serial ports:', error);
|
||||
|
||||
// Reset UI on error
|
||||
$("#node-config-lookup-serial-icon").removeClass('spinner').addClass('fa-search');
|
||||
$("#node-config-lookup-serial").removeClass('disabled');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<!--
|
||||
In - node
|
||||
-->
|
||||
<script type="text/html" data-template-name="arduino in">
|
||||
<div class="form-row">
|
||||
<label for="node-input-arduino"><i class="fa fa-tasks"></i> Arduino</label>
|
||||
@@ -13,15 +102,20 @@
|
||||
<option value="STRING" data-i18n="arduino.state.in.string"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-tips"><span data-i18n="[html]arduino.tip.io"></span></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">
|
||||
<input type="number" min="0" max="99" id="node-input-pin" style="width:20%;" placeholder="2">
|
||||
<div class="form-tips"><span data-i18n="[html]arduino.tip.pin"></span></div>
|
||||
</div>
|
||||
<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>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
|
||||
</div>
|
||||
<div class="form-tips"><span data-i18n="[html]arduino.tip.io"></span></div>
|
||||
<div class="form-tips"><span data-i18n="[html]arduino.tip.more-at-help"></span></div>
|
||||
<div class="form-row">
|
||||
<label><span data-i18n="[html]arduino.version"></span></label>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -42,16 +136,46 @@
|
||||
icon: "arduino.png",
|
||||
label: function() {
|
||||
if (this.state === "STRING") { return "String"; }
|
||||
var a = "";
|
||||
let a = "";
|
||||
if (this.state === "ANALOG") { a = "A"; }
|
||||
return this.name||"Pin: "+a+this.pin;
|
||||
return this.name || "Pin: " + a + this.pin;
|
||||
},
|
||||
labelStyle: function() {
|
||||
return this.name?"node_label_italic":"";
|
||||
return this.name ? "node_label_italic":"";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="arduino in">
|
||||
<p>This is a "Firmata protocol" based communication, between Node-RED and a connected (Arduino, ESP32, RPi-Pico, etc..) board(s), running firmata firmware. </p>
|
||||
<p>It is working with many boards, not just Arduino. </p>
|
||||
<p>This node's code is at: https://github.com/node-red/node-red-nodes/tree/master/hardware/Arduino </p>
|
||||
<p> </p>
|
||||
|
||||
<h3>Settings:</h3>
|
||||
<p>[b]Arduino:[/b] You can create a new "board", or choose from previously created. That will represent the chip or board connected.</p>
|
||||
<p>On Unix/linux systems, it is recommended to choose the COM port at "by-serial", so it works always, no matter which USB port it gets re-plugged.</p>
|
||||
<p><i>(It will look like this:</i> <code>/dev/serial/by-id/usb-Arduino_RaspberryPi_Pico_076461E62D414FE3-if00</code>)</p>
|
||||
<p> </p>
|
||||
<p>[b]Type:[/b] Can be: [Digital in] / [Digital Pullup in] / [Analogue in] / [String]</p>
|
||||
<p>[b]Pin:[/b] a number between 0 and the highest GPIO</p>
|
||||
<p>[b]Warning:[/b] Analogue pins are counted from 0 ! (Not the actual GPIO port.) For example RPi-Pico: [0,1,2,3] where 3 is the built-in Temp reader.</p>
|
||||
<p> </p>
|
||||
|
||||
<h3>The "in" node:</h3>
|
||||
<p>In = Input means: the board which is running firmata is getting data from input pins.</p>
|
||||
<p>Then it is sending those data to the host controller, which runs Node-RED.</p>
|
||||
<p> </p>
|
||||
<p>The sampling interval (frequency), at which data is being collected and sent to host, is set on board's firmata side. If not, default value is: <b>19ms</b> </p>
|
||||
<p>The connection between the board(s) and the host can be Wifi, BlueTooth, USB.\n <i>(But the base protocol through those is: Serial port transfer. Default baudRate: 57600 .) Usually: USB port.</i></p>
|
||||
<p> </p>
|
||||
|
||||
<h3>Change Log + More info:</h3>
|
||||
<p> see: https://github.com/node-red/node-red-nodes/blob/master/hardware/Arduino/README.md </p>
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<script type="text/html" data-template-name="arduino out">
|
||||
<div class="form-row">
|
||||
<label for="node-input-arduino"><i class="fa fa-tasks"></i> Arduino</label>
|
||||
@@ -60,30 +184,58 @@
|
||||
<div class="form-row">
|
||||
<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;">
|
||||
<option value="OUTPUT" data-i18n="arduino.state.out.digital"></option>
|
||||
<option value="PWM" data-i18n="arduino.state.out.analogue"></option>
|
||||
<option value="SERVO" data-i18n="arduino.state.out.servo"></option>
|
||||
<option value="STRING" data-i18n="arduino.state.out.string"></option>
|
||||
<option value="OUTPUT" data-i18n="arduino.state.out.digital"></option>
|
||||
<option value="PWM" data-i18n="arduino.state.out.analogue"></option>
|
||||
<option value="SERVO" data-i18n="arduino.state.out.servo"></option>
|
||||
<option value="STRING" data-i18n="arduino.state.out.string"></option>
|
||||
<option value="RESET" data-i18n="arduino.state.out.reset"></option>
|
||||
<option value="INTERVAL" data-i18n="arduino.state.out.interval"></option>
|
||||
</select>
|
||||
</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">
|
||||
<input type="number" min="0" max="99" id="node-input-pin" style="width:20%;" placeholder="13">
|
||||
<div class="form-tips"><span data-i18n="[html]arduino.tip.pin"></span></div>
|
||||
</div>
|
||||
<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>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
|
||||
</div>
|
||||
<div class="form-tips"><span data-i18n="[html]arduino.tip.io"></span></div>
|
||||
<div class="form-row">
|
||||
<label><span data-i18n="[html]arduino.version"></span></label>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="arduino out">
|
||||
<p>... First read the help at "Arduino in".</p>
|
||||
<p>This node's code is at: https://github.com/node-red/node-red-nodes/tree/master/hardware/Arduino </p>
|
||||
<p> </p>
|
||||
|
||||
<h3>The "in" node:</h3>
|
||||
<p>Out = Output means: you can set individual pins to turn LOW / HIGH / or "x %"=PWM=fast pulses to control voltage.</p>
|
||||
<p>You can select:</p><ul>
|
||||
<li>- <b>Digital</b> - accepts 0, 1, true, false, on, off</li>
|
||||
<li>- <b>Analogue</b> (PWM) - accepts Integer 0 to 255</li>
|
||||
<li>- <b>Servo</b> - accepts Integer 0 - 180</li>
|
||||
<li>- <b>String</b> - to send a *String* to the Arduino</li>
|
||||
<li>- <b>reset</b> - to reset the board, if `msg.payoload = true or 1`</li>
|
||||
<li>- <b>Sampling interval</b> - to set a new time (10ms - 65535ms) how fast analogue input data will be transfered</li>
|
||||
</ul>
|
||||
<p>Digital, PWM, Servo will expects a value in `msg.payload`. </p>
|
||||
<p>The pin number must be set in the properties (config) panel before Deploy.</p>
|
||||
<p> </p>
|
||||
<p>You can also send `msg.payoload = "reset"` to any Output Node without pre-configuring it, to reset the board.</p>
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('arduino out', {
|
||||
category: 'Arduino',
|
||||
color:"#3fadb5",
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
pin: {value:"",validate: function(v) {
|
||||
pin: {value:"", validate: function(v) {
|
||||
var ct = $("#node-input-state").val() || this.state;
|
||||
return ct === 'STRING' || (v !== '');
|
||||
}},
|
||||
@@ -103,49 +255,3 @@
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/html" data-template-name="arduino-board">
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-device"><i class="fa fa-random"></i> <span data-i18n="arduino.label.port"></span></label>
|
||||
<input type="text" id="node-config-input-device" style="width:60%;" data-i18n="[placeholder]arduino.placeholder.port"/>
|
||||
<a id="node-config-lookup-serial" class="red-ui-button"><i id="node-config-lookup-serial-icon" class="fa fa-search"></i></a>
|
||||
</div>
|
||||
<div class="form-tips"><span data-i18n="[html]arduino.tip.conf"></span></div>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('arduino-board',{
|
||||
category: 'config',
|
||||
defaults: {
|
||||
device: {value:""}
|
||||
},
|
||||
label: function() {
|
||||
return this.device||"arduino";
|
||||
},
|
||||
oneditprepare: function() {
|
||||
try {
|
||||
$("#node-config-input-device").autocomplete( "destroy" );
|
||||
} catch(err) { }
|
||||
$("#node-config-lookup-serial").click(function() {
|
||||
$("#node-config-lookup-serial-icon").removeClass('fa-search');
|
||||
$("#node-config-lookup-serial-icon").addClass('spinner');
|
||||
$("#node-config-lookup-serial").addClass('disabled');
|
||||
|
||||
$.getJSON('arduinoports',function(data) {
|
||||
$("#node-config-lookup-serial-icon").addClass('fa-search');
|
||||
$("#node-config-lookup-serial-icon").removeClass('spinner');
|
||||
$("#node-config-lookup-serial").removeClass('disabled');
|
||||
var ports = data || [];
|
||||
$("#node-config-input-device").autocomplete({
|
||||
source:ports,
|
||||
minLength:0,
|
||||
close: function( event, ui ) {
|
||||
$("#node-config-input-device").autocomplete( "destroy" );
|
||||
}
|
||||
}).autocomplete("search","");
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,36 +1,90 @@
|
||||
node-red-node-arduino
|
||||
=====================
|
||||
|
||||
A <a href="http://nodered.org" target="_new">Node-RED</a> node to talk to an
|
||||
Arduino running standard firmata 2.2 or better.
|
||||
This is a <a href="http://nodered.org" target="_new">Node-RED</a> Node module, to talk to an:
|
||||
- **Arduino:** running "standard Firmata" firmware 2.2+, or
|
||||
- **ESP32:** running "Configurable Firmata" 2.7+, or
|
||||
- **Raspberry Pi Pico:** running "Configurable Firmata" 2.7+ firmware
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
Either use the Menu - Manage Palette option or run the following command in your Node-RED user directory - typically `~/.node-red`
|
||||
|
||||
npm i --unsafe-perm node-red-node-arduino
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
The Firmata firmware must be loaded into the Arduino.
|
||||
through serial port.
|
||||
_Typically plugged in to the host via USB to extend: I/O + analogue + I2C + OneWire + other Serial ports._
|
||||
|
||||
See the [main documentation](http://nodered.org/docs/hardware/arduino.html) for
|
||||
details and examples of how to use this node.
|
||||
|
||||
See list of changes and latest features (with pictures) at: [NR's forum](https://discourse.nodered.org/t/announce-node-red-node-arduino-firmata-remastered-v1-3-3/96317).
|
||||
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
Either use the Menu - Manage Palette option,
|
||||
or run the following command in your Node-RED user directory - typically `~/.node-red`
|
||||
|
||||
npm i --unsafe-perm node-red-node-arduino
|
||||
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
The Firmata firmware must be loaded to the Arduino/RpiPico/ESP32 board.
|
||||
Recommended to use: [Configurable firmata](https://github.com/firmata/ConfigurableFirmata)
|
||||
|
||||
You can add a firmware-specific name to each board before flashing/uplading, if you insert this line at setup:
|
||||
```
|
||||
void setup() {
|
||||
// Set firmware name and version. Do this before initTransport(), because some client libraries expect that a reset sends this automatically.
|
||||
Firmata.setFirmwareNameAndVersion("ArduinoFirmata-42-spec-name", FIRMATA_PROTOCOL_MAJOR_VERSION, FIRMATA_FIRMWARE_MINOR_VERSION);
|
||||
initTransport();
|
||||
```
|
||||
This will help identify from console-log which board is using which port.
|
||||
|
||||
You may check the "Log to console" checkbox at board setup page. _(Default: Un-Checked.)_
|
||||
Use it on only at the beginning, for debugging errors.
|
||||
Turn Logging OFF (uncheck) in production to reduce log size and increase speed.
|
||||
|
||||
### To view console Logs:
|
||||
|
||||
- If you started node-red in a consol, you will be able to see them there.
|
||||
- Otherwise type in a console/terminal:> `node-red-log`
|
||||
|
||||
Note: On node-red's right sidebar (in your browser window) only errors are visible.
|
||||
|
||||
Main Board Settings:
|
||||
--------------------
|
||||
These are hidden (non-visual) configuration Nodes called: **Arduino:**
|
||||
You can create a new ones, or choose from previously created. That will represent the chip or board connected.
|
||||
|
||||
**Note:** On Unix/linux systems, it is recommended to choose the COM port at **"by-id"** path, so it works always, no matter which USB port it gets plugged in.
|
||||
_(It will look like this: `/dev/serial/by-id/usb-Arduino_RaspberryPi_Pico_076461E62D414FE3-if00` )_
|
||||
|
||||
|
||||
### Input Node
|
||||
|
||||
Connects to local Arduino and monitors the selected pin for changes.
|
||||
Connects to local board and monitors the selected pin for changes.
|
||||
Sends the value as `msg.payload` and the pin number as `msg.topic` to the next Node.
|
||||
|
||||
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`.
|
||||
- **Type:** You can select either **Digital**, **Pullup**, **Analogue**, or **String** input type.
|
||||
|
||||
- **Pin:** a number between 0 and the highest GPIO
|
||||
- **Warning:** Analogue pins are counted from 0 ! (Not the actual GPIO port.) For example RPi-Pico: [0,1,2,3] (and not 26-29,) where `A3` is the built-in Temp reader.
|
||||
|
||||
|
||||
It only outputs **on a change** of the value.
|
||||
That's 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.
|
||||
|
||||
Also you can lower the reading rate by setting a higher: **Sampling interval**.
|
||||
Default read rate is: 250ms = 4 message/second.
|
||||
You can change that at the config panel of the board or during runtime. But not individually per pin.
|
||||
|
||||
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.
|
||||
|
||||
### Output Node
|
||||
|
||||
Connects to local Arduino and writes to the selected pin.
|
||||
Connects to local board and writes to the selected pin.
|
||||
|
||||
You can select
|
||||
|
||||
@@ -38,14 +92,23 @@ You can select
|
||||
- **Analogue** (PWM) - accepts Integer 0 to 255
|
||||
- **Servo** - accepts Integer 0 - 180
|
||||
- **String** - to send a *String* to the Arduino
|
||||
- **reset** - to reset the board, if `msg.payoload = true or 1`
|
||||
- **Sampling interval** - to set a new time (10ms - 65535ms) how fast analogue input data will be transfered
|
||||
|
||||
Digital, PWM, Servo will expects a value in `msg.payload`.
|
||||
The pin number must be set in the properties (config) panel before Deploy.
|
||||
|
||||
Expects a numeric value in `msg.payload`. The pin number is set in the properties panel.
|
||||
You can also send `msg.payoload = "reset"` to any Output Node without pre-configuring it, to reset the board.
|
||||
_(Reset will set all output pins to LOW, and will stop sending analogue values)_
|
||||
_Note:_ it happens very fast. So if there is only a "LED blink", you will hardly notice anything, because "output" will work again after a few milliseconds.
|
||||
Analogue read (and maybe digital in too!) will stop completely until flow restart.
|
||||
|
||||
*Note* - some servos will not travel a full 180 degree range so may only accept 30 - 150 degrees for example.
|
||||
*Note2* - some servos will not travel a full 180 degree range. _(Maybe only accepting 30 - 150 degrees for example.)_
|
||||
Please use the `range` node to scale the input appropriately.
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
Simple flow to blink Pin 13
|
||||
Simple flow to blink Pin: 13 (arduino LED). Change Pin to: 25 for RPi Pico LED
|
||||
|
||||
[{"id":"d7663aaf.47194","type":"arduino-board","device":""},{"id":"dae8234f.2517e","type":"inject","name":"0.5s tick","topic":"","payload":"","payloadType":"date","repeat":"0.5","crontab":"","once":false,"x":150,"y":100,"z":"359a4b52.ca65b4","wires":[["56a6f8f2.a95908"]]},{"id":"2db61802.d249e8","type":"arduino out","name":"","pin":"13","state":"OUTPUT","arduino":"d7663aaf.47194","x":570.5,"y":100,"z":"359a4b52.ca65b4","wires":[]},{"id":"56a6f8f2.a95908","type":"function","name":"Toggle output on input","func":"\n// If it does exist make it the inverse of what it was or else initialise it to false\n// (context variables persist between calls to the function)\ncontext.level = !context.level || false;\n\n// set the payload to the level and return\nmsg.payload = context.level;\nreturn msg;","outputs":1,"noerr":0,"x":358,"y":100,"z":"359a4b52.ca65b4","wires":[["2db61802.d249e8"]]}]
|
||||
[{"id":"2db61802.d249e8","type":"arduino out","z":"65fc95b26b02d8a1","name":"","pin":"13","state":"OUTPUT","arduino":"d7663aaf.47194","x":240,"y":80,"wires":[]},{"id":"38edc285adb170c9","type":"inject","z":"65fc95b26b02d8a1","name":"","props":[{"p":"payload"}],"repeat":"0.31","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":89.5,"y":40,"wires":[["2db61802.d249e8"]]},{"id":"1e034bcd12c2bf12","type":"inject","z":"65fc95b26b02d8a1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"0.91","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":89.5,"y":80,"wires":[["2db61802.d249e8"]]},{"id":"00793c4da9c669e2","type":"comment","z":"65fc95b26b02d8a1","name":"Set Port first!","info":"","x":250,"y":40,"wires":[]},{"id":"d7663aaf.47194","type":"arduino-board","device":"","name":"Led-Test-board","samplingInt":"500","log2consol":true}]
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
{
|
||||
"arduino": {
|
||||
"version": "version: 1.3.4-20250331",
|
||||
"label": {
|
||||
"pin": "Pin",
|
||||
"type": "Type",
|
||||
"port": "Port"
|
||||
"pin": "Pin:",
|
||||
"type": "Type:",
|
||||
"port": "Port:",
|
||||
"name": "Name:",
|
||||
"samplingInt": "Sampling interval:"
|
||||
},
|
||||
"placeholder": {
|
||||
"port": "e.g. /dev/ttyUSB0 COM1"
|
||||
"port": "(like: COM1 or /dev/ttyUSB0)",
|
||||
"samplingInt": "(10 - 65535)"
|
||||
},
|
||||
"status": {
|
||||
"connectfirst": "connecting to first board found",
|
||||
@@ -26,16 +30,23 @@
|
||||
"digital": "Digital (0/1)",
|
||||
"analogue": "Analogue (0-255)",
|
||||
"servo": "Servo (0-180)",
|
||||
"string": "String"
|
||||
"string": "String",
|
||||
"reset": "Reset Board on .payload=true",
|
||||
"interval": "Set new sampling interval"
|
||||
}
|
||||
},
|
||||
"tip": {
|
||||
"io": "<b>Note:</b> You cannot use the same pin for both output and input.",
|
||||
"conf": "<b>Tip:</b> Use search to try to auto-detect serial port."
|
||||
"io": "<b>Note:</b> You cannot use the same pin for both output and input!",
|
||||
"port": "<p>On Unix/linux systems, it is recommended to choose the serial port at: <b>by-id</b> path, so it works always, no matter which USB port it gets re-plugged.</p><p><i>(It will look like this:</i> <code>/dev/serial/by-id/usb-Arduino_RPi_Pico_0764FE3-if00</code>)</p>",
|
||||
"search": "<b>Tip:</b> Use search button to try to auto-detect serial port.",
|
||||
"pin": "<b>Analogue pins:</b> usually between: <b>0..7</b><br>RPi-Pico has a built-in temperature reader at: <b>A03</b>",
|
||||
"log2consol": "<b>To view Logs:</b> If you started node-red in a console, you will be able to see them there. Otherwise type in a consol/terminal:<code> node-red-log </code>",
|
||||
"otherboards": "To use this module with [Raspberry Pi - Pico] / [ESP32], you need to flash to the chip a [Configurable-Firmata] firmware: https://github.com/firmata/ConfigurableFirmata",
|
||||
"more-at-help": "See more info at the Help tab."
|
||||
},
|
||||
"errors": {
|
||||
"portnotconf": "port not configured",
|
||||
"portnotfound": "port not found : __device__",
|
||||
"portnotfound": "port not found / not accessible: __device__",
|
||||
"devnotfound": "device __dev__ not found. Trying to find board."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "node-red-node-arduino",
|
||||
"version": "1.1.0",
|
||||
"description": "A Node-RED node to talk to an Arduino running firmata",
|
||||
"version": "1.3.4-20250331",
|
||||
"description": "A Node-RED Node, to talk to a chip as I/O extender, which is running Firmata firmware",
|
||||
"dependencies": {
|
||||
"serialport": "^12.0.0"
|
||||
},
|
||||
@@ -13,8 +13,10 @@
|
||||
"license": "Apache-2.0",
|
||||
"keywords": [
|
||||
"node-red",
|
||||
"firmata",
|
||||
"arduino",
|
||||
"firmata"
|
||||
"RPi-pico",
|
||||
"ESP32"
|
||||
],
|
||||
"node-red": {
|
||||
"version": ">=3.0.0",
|
||||
@@ -26,8 +28,16 @@
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"author": {
|
||||
"name": "Dave Conway-Jones",
|
||||
"name": "Dave Conway-Jones (version <= 1.1)",
|
||||
"email": "dceejay@gmail.com",
|
||||
"url": "http://nodered.org"
|
||||
}
|
||||
},
|
||||
"contributors": [{
|
||||
"name": "PizzaProgram (from version 1.2+ 2025-03-21)",
|
||||
"email": "info@pizzaprogram.hu",
|
||||
"url": "https://pizzaprogram.hu"
|
||||
}],
|
||||
|
||||
"foreground-scripts": true
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user