Files
node-red-nodes/io/serialport/locales/en-US/25-serial.html
2023-11-21 12:20:38 +09:00

128 lines
7.3 KiB
HTML

<script type="text/html" data-help-name="serial in">
<p>Reads data from a local serial port.</p>
<h3>Outputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string | buffer</span></dt>
<dd>received data via the serial port</dd>
<dt>port <span class="property-type">string</span></dt>
<dd>name of the serial port</dd>
</dl>
<p>The node can either
<ul>
<li>wait for a "split" character (default \n).
Also accepts escaped shortcut (e.g. \n) or hex notation (0x0d).</li>
<li>wait for a timeout in milliseconds from the first character received.</li>
<li>wait for a silence time in milliseconds after the last character received.</li>
<li>wait to fill a fixed sized buffer.</li>
</ul>
</p>
<p>It then outputs <code>msg.payload</code> as either a UTF-8 ASCII string or a binary buffer object.</p>
<p><code>msg.port</code> is set to the name of the port selected.</p>
<p>If no split character is specified, or a timeout or buffer size of 0,
then a stream of single characters is sent -
again either as ASCII chars or size 1 binary buffers.</p>
</script>
<script type="text/html" data-help-name="serial out">
<p>Send data via a local serial port.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload <span class="property-type">string | buffer</span></dt>
<dd>data to be sent via the serial port</dd>
<dt class="optional">baudrate <span class="property-type">string</span></dt>
<dd>baudrate of the serial port (optional)</dd>
</dl>
<p>Only the <code>msg.payload</code> is sent.</p>
<p>Optionally the baudrate can be changed using <code>msg.baudrate</code>.</p>
<p>Optionally the new line character used to split the input
can be appended to every message sent out to the serial port.</p>
<p>Binary payloads can be sent by using a buffer object.</p>
</script>
<script type="text/html" data-help-name="serial request">
<p>Provides a connection to a request/response serial port.</p>
<p>This node behaves as a tightly coupled combination of <code>serial in</code> and <code>serial out</code> nodes,
with which it shares the configuration.</p>
<p>Send the request message in <code>msg.payload</code> as you would do with a <code>serial out</code> node.
The message will be forwarded to the serial port following a strict FIFO (First In, First Out) queue,
waiting for a single response before transmitting the next request.
Once a response is received (with the same logic of a <code>serial in</code> node), or after a timeout occurs,
a message is sent to the output (see Outputs below),
with <code>msg.payload</code> containing the received response (or missing in case if timeout) and
all other properties are preserved.</p>
<p>For consistency with the <code>serial in</code> node, <code>msg.port</code> is set to the name of the port selected.</p>
<h3>Inputs</h3>
<ul>
<li><code>msg.timeout</code> is the timeout (in ms) after which the incoming message is propagated
to the output with <code>msg.status</code> set to <code>"ERR_TIMEOUT"</code> and missing payload.
If not present, the default value is 10000 (10s).</li>
<li><code>msg.count</code> if set this will override the configured number of characters
as long as it is less than the number configured.</li>
<li><code>msg.waitfor</code> must be a single character, escape code, or hex code.
If set, the node will wait until it matches that character in the stream and then start the output.</li>
<li>Optionally the baudrate can be changed using <code>msg.baudrate</code></li>
</ul>
<h3>Outputs</h3>
<ul>
<li><code>msg.payload</code> is the response. If no response occured, this property is removed.</li>
<li><code>msg.status</code> is <code>"OK"</code> in case a response is received,
or <code>"ERR_TIMEOUT"</code> if a timeout occurs.</li>
<li>Any other property coming from the input will be preserved.</li>
</ul>
</script>
<script type="text/html" data-help-name="serial-port">
<p>Configuration options for a local serial port.</p>
<p>The search button should return a list of available serial ports to choose from,
or you can type in the location if known.</p>
<p>The DTR, RTS, CTS and DSR switches can be used to permanently pull the corresponding flow control pin high or low,
e.g. in order to power devices via those pins.</p>
<p>The node can optionally wait until it matches a pre-defined character.</p>
<p>The serial data reception can either
<ul>
<li>wait for a "split" character (default \n). Also accepts escaped shortcut (e.g. \n) or hex notation (0x0d).</li>
<li>wait for a timeout in milliseconds from the first character received.</li>
<li>wait for a silence time in milliseconds after the last character received.</li>
<li>wait to fill a fixed sized buffer.</li>
</ul>
</p>
<p>It then outputs the received data as either a UTF-8 ASCII string or a binary buffer object.</p>
<p>If no split character is specified, or a timeout or buffer size of 0, then a stream of single characters is sent -
again either as ASCII chars or size 1 binary buffers.</p>
<p>Optionally the new line character used to split the input
can be appended to every message sent out to the serial port.</p>
</script>
<script type="text/html" data-help-name="serial control">
<p>Stops, starts the serial communication and changes the serial port configuration.</p>
<p>This node provides the serial port control capability to</p>
<ul>
<li>stop the communication and releasing the serial port so, for example the Arduino can upload the new binary without shutting down the nodered.</li>
<li>start the communication after stopped with this `Serial Control` node for above reason or the like.</li>
<li>change the serial port and the configuration on the run time programatically.</li>
<li>query the serial port configuration if empty or no valid configuration parameters are passed.</li>
</ul>
<h3>Inputs</h3>
<p>In order to control the communication, just send these JSON messages to the control node.</p>
<code>
{
"serialport": "/dev/tty.usbmodem1234561",
"serialbaud": 115200,
"databits": 8,
"parity": "none",
"stopbits": 1
"enable": true
}
</code> changes the serial port and the configuration on the fly.
The following parameters are optional and will change the configuration only if they are present.
"serialport", "serialbaud", "databits", "parity", "stopbits", "dtr", "rts", "cts", "dsr", "bin", "out"
<code>{"enable":true}</code> or <code>{"enable":false}</code> will stop or start the communication. And 'enable' can be passed along with the other configuration parameters as well, which will then change the configuration and either start or just stopped and ready to start.
<h3>Outputs</h3>
<p><code>msg.payload</code> is the response. It contains the serial port configuration</p>
</script>