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?
sorry if this question has come before but i did spend a long
time looking.
regards
r.y
How did you manage to print the values? I guess using [print]. If so, instead of [print] put [unpack f f f f] if the four values are output as a list (through [comport] would output separate bytes).
On Fri, Oct 23, 2015 at 6:49 PM, ray Y raybuay@hotmail.com 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?
sorry if this question has come before but i did spend a long
time looking.
regards
r.y
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
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