write_data
Write string or hex data to an open serial port. Specify port, data, encoding, and hex mode.
Instructions
Write data to an open serial port.
Data can be a regular string (encoded with the specified encoding) or a hex string if hex_mode is True.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| port_id | Yes | The port identifier | |
| data | Yes | Data to write (string or hex if hex_mode is True) | |
| encoding | No | Text encoding for string data | utf-8 |
| hex_mode | No | Interpret data as hex string (e.g., '48454C4C4F') |