Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Parsing constant stream of bytes from Serial

$
0
0
Hi,

I need your advice as i am trying to write a sketch to receive data from external box.
Box  sends constant stream of bytes.
xxxx 255 255 255 255   124  86  107 11   0  31  0  1   23 15  2 240 76 255 255 255 255 xxxx
        ^---------------------------one frame of data --------------------------------------^

255 255 255 255 is frame marking beginning or ending (it does not matter) and data between is actual valid data with time stamp + 3 sensor values.

Could you advice which approach will be best to reliably read and process this stream.
as a first step i will be happy to collect full frame with no errors.

I am bit puzzled.
as
myPort.bufferUntil(255);
 is waiting for specific byte and i need to wait for 4x 255 bytes in a row

br
Dan

Viewing all articles
Browse latest Browse all 1768

Trending Articles