The idea is that I program my Arduino to continuously spit out data with "Serial.println( ... )". Then in PERL on Linux, I want to capture the data stream and do something fancy with it.
The problem I'm facing is that during boot of the Arduino, it starts sending a varying number of NUL-bytes and these NUL bytes mess up my post processing. So I want to skip these bytes in my PERL script: http://wirespeed.xs4all.nl/mediawiki/index.php/Cat_ttyUSB0
Also there is a hexdump at the bottom of that wiki article that shows the exact problem.
I don't want to use handshaking in the data stream so I can use the same script for other devices than Arduino. Basically what my script needs is:
if ( next-byte-in-receive-buffer == NUL ) {
drop-the-byte;
} else {
leave-the-byte-in-receive-buffer;
}
print $received-byte;
Anyone know how I can peek at the next byte in the serial receive buffer?