Serial Write
This function block sends raw data over a selected serial connection. It is built for simple, non-blocking transmissions and provides convenient UI options to convert common data types, append line endings, and control re-transmission behavior.
π₯ Inputs
Enable Use to enable or disable sending. When false the block does not send data.
Data The payload to send. Accepts numbers, text, lists, booleans or byte-like values depending on selected controls.
ConnId Identifier of the serial connection to use. Provide the connection id produced by a connection manager block.
π€ Outputs
This function block does not produce outputs.
πΉοΈ Controls
Data Type Choose how the provided Data will be converted before sending. Common choices include string, integer, float, boolean, and byte/hex formats.
Line ending Select a trailing sequence to append to the payload. Options typically include LF, CRLF, CR or none.
Send policy Choose when to transmit:
On changeonly sends when the final byte payload differs from the last sent payload.Alwayssends every time the block is evaluated and enabled.
π¨ Features
Data type conversion for common formats, so you can input human-friendly values and the block will send the corresponding byte sequence.
Optional configurable line ending to match remote device expectations.
Send policy to avoid repeating identical messages when not needed.
Non-blocking write behavior so the flow keeps running while data is transmitted.
Works with external connection manager blocks that provide
ConnIdvalues.
π Running mechanism
When the block is evaluated:
If the
Enableinput is inactive or empty, nothing is sent.If valid
DataandConnIdare present, the block convertsDataaccording to the selectedData Typeand appends the chosenLine ending.If
Send policyisOn change, the block compares the prepared payload to the previous payload and skips sending if identical.The prepared byte payload is sent to the serial connection referenced by
ConnIdwithout blocking the rest of the system.
π Usage instructions
Create or select a serial connection and note its connection id.
Provide that id to the
ConnIdinput.Feed the value you want to send into the
Datainput.Set the
Data Typecontrol to match your data (for example useHexBytesfor hex strings orBytesfor raw byte lists).Choose the desired
Line endingif the receiving device expects one.Use
Send policyto avoid unnecessary repeats when streaming constant values.Toggle
Enableto start or stop sending.
π‘ Tips and Tricks
Combine with
Serial Connect/ connection manager blocks (the system's connection manager) to obtain and manageConnIdvalues.Use
String InputorNumber Inputblocks to prepare and validate theDatabefore sending.Pre-format complex payloads with
String MergeorData to JSONwhen you need structured strings (for example JSON messages).If you need to log or export sent data, add
CSV ExportorImage Logger(for visual logs) downstream in your flow.For conditional sending based on logic, combine with
Logic Input,And,Or, orGreaterblocks to gate transmissions.For protocol bridges, pair with
MQTT PublishorREST API - Postto forward serial data to network services.Use
Debug Inputto inspect the outgoing payloads during development.
π οΈ Troubleshooting
Nothing is sent: verify
Enableis active,Datais not empty, andConnIdreferences an active connection.Receiving device ignores messages: check the chosen
Line endingand try different options (LF, CRLF, CR or none).Identical messages not sent when expected: confirm
Send policyis set toAlwaysif you need repeated sends.Unexpected bytes on the wire: ensure
Data Typematches the value format you provide (for example useHexBytesfor hex strings orBytesfor numeric lists).
Last updated