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



Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to