Hi,
I've been working on this for a while now with no success, so it's time to ask for some help.
I'm using Node-Red on a RPI with node-red-node-serialport to communicate with a serial device that accepts ASCII commands. Mostly this is working, however, I need to send an escape character: CTRL-C to switch operating modes on the device. Sending as a string does not work, so I am attempting to send this as a buffer containing 0x03. I am expecting this should send to the device, but I am getting an error from the serial port node:
9/16/2020, 9:47:29 AMnode: 6bf07264.52d10cmsg.payload : buffer[1]
[ 3 ]
9/16/2020, 9:47:29 AMnode: 254eb66d.fa32a2
msg : error
"TypeError [ERR_INVALID_ARG_TYPE]: The "list[1]" argument must be one of type Array, Buffer, or Uint8Array. Received type string"
This is the flow I'm using to test this:
[{"id":"6bf07264.52d10c","type":"debug","z":"32cf40d4.4b2a7","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1450,"y":700,"wires":[]},{"id":"417b8d50.e8b3f4","type":"inject","z":"32cf40d4.4b2a7","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[3]","payloadType":"bin","x":1250,"y":660,"wires":[["6bf07264.52d10c","254eb66d.fa32a2"]]},{"id":"254eb66d.fa32a2","type":"serial out","z":"32cf40d4.4b2a7","name":"","serial":"b2472a99.985c7","x":1450,"y":640,"wires":[]},{"id":"b2472a99.985c7","type":"serial-port","z":"","serialport":"/dev/ttyUSB0","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"high","rts":"high","cts":"high","dsr":"high","newline":"\\n","bin":"bin","out":"char","addchar":"","responsetimeout":"10000"}]
I found this previous thread with the same issue, but the resolution of clearing the "Add character to output messages" value in the serial settings doesn't help. I have tried with this field empty and with \r.
The problem seems to be the serial module to not recognize the buffer coming into it, and sees it as a string.
Even if i sort out the buffer - serial issue, I'm not sure if this will solve my issue of sending a CTRL-C, but I can't get past it.
Any help is most appreciated!
Thanks,
D