Go Down

Topic: send two values to processing via serial port (Read 554 times) previous topic - next topic

HCPUNK

hi! i'd like to know if someone has ever tried to send two different values from a single serial port.. i wonder how it could be possible to parse the information in processing in order to put those values into different variables.. any suggestions?

thanks in advance!

PaulS

Quote
i'd like to know if someone has ever tried to send two different values from a single serial port.

Yes, of course.

Code: [Select]
Serial.print(47);
Serial.print(",");
Serial.println(99);


Quote
i wonder how it could be possible to parse the information in processing in order to put those values into different variables.

Open the serial port. Use the bufferUntil() method to define when to call the serialEvent() callback.

Define the serialEvent() callback. In that function, the String returned by Serial.read() will contain the whole string read. That string can be split into an array of integers, in one step.

HCPUNK

i've come to realize i don't have any ideas of how to even read a single value. would you mind pointing me to any tutorial or stuff? all the examples in processing work in different ways, making it hard to understand the whole reading process

dxw00d

There are examples supplied with Processing that show serial communication to/from an Arduino, in Examples->Serial I/O.

Go Up