For multiple data transmission, I recommend you to read this post below:
- As you can see, on the Arduino side, separate the data w/
\t
using print() + write(). - And then send the last data w/ println().
- On the Processing side, inside serialEvent(), use Serial::readString() + PApplet.splitTokens() in order to get all the data as a String[] array.
- Of course, you’re still gonna need to convert each data in that received array to their corresponding datatype if that data isn’t a String.
- And don’t forget to use
bufferUntil(ENTER)
after instantiating the class Serial.