serial.tx()
serial.tx(port, data)
Transmits data on a serial port.
Sends data out the port. Remember to append your protocol's end-of-message
delimiter (e.g. "\r") so the receiver's serial.listen() fires.
Arguments
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| port | number | yes | — | 1 = isolated RS-485, 2 = non-isolated RS-485. |
| data | string | yes | — | Data to send — hex-encode binary payloads with bin.toHex(). |
Example
serial.tx(port, "Hello World over serial!\r");