extract a list from serial port data...

nicnut's icon

Hi,

I am involved in a project that uses sensor data from the serial port. Up to now it has been fine as I have been using one sensor and it's fine. But I am trying to integrate three sensors and the incoming data is in the form of a list. Like " 96 200 1000, 96 201 1010," etc.

I am pasting a patch below. I think I am missing something when getting a list out of the serial port.
If anyone has any input or ideas to try I would really appreciate it. I tried unpack f f f but doesn't seem to work.

thank you.

nick

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

if you send LAST of 3 numbers in arduino using
println, then

in arduino :
serial.print(int1); serial.print(int2); serial.println(int3);

P.S. are you sending a float really ?

nicnut's icon

Hi,

Thank you for the reply. I will try this.
I am using float values in Max just to make sure I'm not missing anything due to integer objects filtering out floats. I actually don't know what is coming out, if it's floats or ints.

Source Audio's icon

you don't know what you send ?
if you simply read analog input and don't do any conversion
or scaling it is ints.

nicnut's icon

Hi Source Audio. Thank you for your suggestion/patch by the way.

I am not involved in the programming of the microcontroller, and it's not an Arduino. So I am trying to be able to catch all the data. It probably is ints, but just to be sure I was using floats. Hopefully it won't make a difference.

Source Audio's icon

Then I would print received values to max console to see the stream of raw data.

if new line or line feed gets sent,
you will see it from sel 10 13 object.
all other data should get printed to max console.
That can help detect what is being sent

nicnut's icon

Hi Source Audio.

the first example you posted actually works. Amazing. thank you for that!

If I have any more issues I'll post but I think this might be resolved.

thanks, Nick