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?
thanks, Dave
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
Check the rePatcher Pd patch http://wiki.openmusiclabs.com/wiki/Repatcherthey are sending the hexadecimal 0xc0 for the beginning of the data stream (decimal 192) and then collect the rest of the values. If this is what you need..It works fine for me.
On Thu, Dec 12, 2013 at 2:41 PM, David Welch nicederangement@gmail.comwrote:
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?
thanks, Dave
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list