[PD] routing serial data

IOhannes m zmölnig zmoelnig at iem.at
Fri Oct 23 20:31:44 CEST 2015


On 10/23/2015 05:49 PM, ray Y wrote:
> hello
> 
> 
> i'm having difficulties separating incoming data from the serial port.
> 
> i cannot use pduino and firmata because of pining complications
> 
> with ultrasound sensors. i manage to have the 4 readings print out
> 
> in the pd window but how can i get each one into an atom box?
> 


whenever a new value comes in, increment a counter (wrap the counter
once you reach 4), prepend the counter to the value and use route.
the problem here is that you don't really know when to start.

consider a series:

... 4 2 8 5 6 9 3 1 7 ...

which value comes from the 1st sensor?

one solution to this is to transmit a reserved value (one that will
never be sent from a sensor) before you actually send the values.
e.g. in the example above we could use '0' as a delimiter (but only if
we make sure that the sensors never actually send 0):

.... 4 2 0 8 5 6 9 0 3 1 7 ...

so you see that the first "4" we have seen actually belongs to the 3 sensor.

gmdsr
IOhannes



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20151023/c54b5b03/attachment-0001.sig>


More information about the Pd-list mailing list