I am using the serial node to communicate over RS232 and I am getting additional characters in my string response. Would anyone have an idea of what these characters are and how to remove them?
sample:
22.03
I am using the serial node to communicate over RS232 and I am getting additional characters in my string response. Would anyone have an idea of what these characters are and how to remove them?
sample:
22.03
Question:
What baud rate?
What structure is/are the messages?
WHO is sending them? (Arduino, some other device)
Just thoughts....
Stop bits wrong.
Parity wrong.
Have you tested the RS232 link with another device?
they will be either linefeed/carriage returns or control characters like STX, ETX etc.
Change the output to a buffer and you will be able to see the character code byte values.
Looks like it is XON, XOFF and Line feed. Any idea on the best way to remove?
const asciiPayload = msg.payload.replace(/[\x00-\x1F\x7F-\x9F]/g, '').replace(/[^\x20-\x7E]/g, '');
msg.payload = asciiPayload;
return msg;
try that in a function node.. or you could do a regular expression in a change node
This was from an old project so no warranty on code