On 2013-12-12 07:41, David Welch wrote:
say I have a stream of ASCII numbers coming in from an Arduino device.
It contains a letter indicating the beginning of the stream, something
like (when you translate from ASCII):

B 1023 1022 1021 1023 1021 etc.

Does anyone know how one can process this in such a way that the numbers
are handled in the same order, correctly?

One way is to have a counter that resets with the 'B' character. Use [pack 0 0] to prefix the count to each received character and then use [route 0 1 2 3...] to extract the characters at the correct position. This doesn't work if the 'B' character can be part of the list. A more robust solution is to use SLIP to encode the packets in the Arduino and [slipdec] from pd-extended to decode them.

Martin


_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to