How do I use serialport node to write to a RS485

If you want to send 68 03 01 00 22 aa 04 9e to the serial port then use either a SERIAL Request or SERIAL Out node.

Use an INJECT to send a buffer with 68 03 01 00 22 aa 04 9e

As i said before...
inject (set some data in the payload) :point_right: serial request (setup the correct com settings) :point_right: debug node (see if you get a reply)

They have buffers (which are byte arays)

There is no JavaScript required for this - it is a "no code"

example...
image

↑ Not a bit of JavaScript in sight

Demo flow (use CTRL-I to import it)...

[{"id":"9d6f8adbbaf48ea1","type":"inject","z":"b1e41431717e4e05","name":"[\"0x68\",\"0x03\",\"0x01\",\"0x00\",\"0x22\",\"0xaa\",\"0x04\",\"0x9e\"]","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"0x68\",\"0x03\",\"0x01\",\"0x00\",\"0x22\",\"0xaa\",\"0x04\",\"0x9e\"]","payloadType":"bin","x":290,"y":700,"wires":[["108f6d38a4465865"]]},{"id":"6306a144b714f63a","type":"serial in","z":"b1e41431717e4e05","name":"","serial":"85ed1317.7df08","x":150,"y":820,"wires":[["b539eb2d1e88055f"]]},{"id":"108f6d38a4465865","type":"serial out","z":"b1e41431717e4e05","name":"","serial":"85ed1317.7df08","x":150,"y":760,"wires":[]},{"id":"b539eb2d1e88055f","type":"debug","z":"b1e41431717e4e05","name":"from serial port","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":420,"y":820,"wires":[]},{"id":"4291d5a4222128a3","type":"inject","z":"b1e41431717e4e05","name":"[\"0x68\",\"0x03\",\"0x01\",\"0x00\",\"0x22\",\"0xaa\",\"0x04\",\"0x9e\"]","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[\"0x68\",\"0x03\",\"0x01\",\"0x00\",\"0x22\",\"0xaa\",\"0x04\",\"0x9e\"]","payloadType":"bin","x":290,"y":440,"wires":[["815d91315a9adf9f"]]},{"id":"815d91315a9adf9f","type":"serial request","z":"b1e41431717e4e05","name":"","serial":"85ed1317.7df08","x":150,"y":500,"wires":[["77c7937de8058de1"]]},{"id":"77c7937de8058de1","type":"debug","z":"b1e41431717e4e05","name":"from serial port","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":420,"y":500,"wires":[]},{"id":"de62fc3ed3c6c8be","type":"comment","z":"b1e41431717e4e05","name":"Using the Request / response pattern","info":"","x":230,"y":400,"wires":[]},{"id":"aa2abd9269d72d90","type":"comment","z":"b1e41431717e4e05","name":"Using the In / Out pattern","info":"","x":190,"y":660,"wires":[]},{"id":"85ed1317.7df08","type":"serial-port","serialport":"/dev/ttyUSB5","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"200","bin":"bin","out":"interbyte","addchar":"","responsetimeout":"2000"}]