# splitTokens() question

**URL:** <https://discourse.processing.org/t/splittokens-question/17076>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [January 14, 2020, 5:18am UTC](https://discourse.processing.org/t/splittokens-question/17076 "2020-01-14T05:18:05Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [January 14, 2020, 7:44am UTC](https://discourse.processing.org/t/splittokens-question/17076/3 "2020-01-14T07:44:40Z")

</div>

> [@\[SOLVED\] ArrayIndexOutOfBoundsException: 1](https://discourse.processing.org/t/solved-arrayindexoutofboundsexception-1/2288/7):
>
> For multiple data transmission, I recommend you to read this post below: electric_plug[Forum.Processing.org/two/discussion/16618/processing-with-arduino-void-serialevent#Item\_1](http://Forum.Processing.org/two/discussion/16618/processing-with-arduino-void-serialevent#Item_1) 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 conver…

> [@Using two different readStringUntil "characters"](https://discourse.processing.org/t/using-two-different-readstringuntil-characters/10769/6):
>
> The solution I gave on that link expects the Arduino C code to send the multi-data as if they were a row of tab-separated values (TSV): face_with_monocle That is, each value is followed by a \t character; except last 1, which is followed by an \n instead: nerd_face Serial.print(temperature); Serial.write('\t'); Serial.print(masse); Serial.write('\t'); Serial.print(humidite); Serial.write('\t'); Serial.print(comptage); Serial.write('\t'); Serial.println(son); // implies '\n' At the Pro…

---

_[View the full topic](https://discourse.processing.org/t/splittokens-question/17076)._
