Serial node red raspberry pi/arduino

I'm looking for a solution, I'm serial communicating back and forth between Node Red and an Arduino via a Raspberry Pi based API USB port.
My Arduino UNO serves as a fast input board for two encoders. Via serial communication, the time in milliseconds and the number of steps taken are sent back to calculate a speed on Node Red which will be used to control and regulate the speed of my DC motors. Everything works, however, I have one problem, which is that I am not reading the latest data sent by the Arduino via serial communication, because the old data remains stored in a buffer at the output of the "Serial in" node in the "node-red-node-serialport" palette.
How can I flush this buffer or recover the last sent serial message?
I hope someone can guide me to a solution.
Best wishes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.