# Using two different readStringUntil "characters"

**URL:** https://discourse.processing.org/t/using-two-different-readstringuntil-characters/10769
**Category:** Electronics (Arduino, etc.)
**Tags:** homework
**Created:** [April 29, 2019, 11:10pm UTC](https://discourse.processing.org/t/using-two-different-readstringuntil-characters/10769 "2019-04-29T23:10:54Z")
**Posts on this page:** 1
**Showing post:** 17

<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: [May 2, 2019, 10:58am UTC](https://discourse.processing.org/t/using-two-different-readstringuntil-characters/10769/17 "2019-05-02T10:58:26Z")

</div>

Well, I don’t have any Arduino hardware and neither even seen 1 in front of me yet! 🥴

So I can only do blind coding in the dark for you. 🕶

Theoretically, an Arduino C code like this 1: 🤔

```auto
void setup() {
  Serial.begin(115200);
}

void loop() {
  const int x = map(analogRead(A1), 0, 1023, -10, 10);
  const int y = map(analogRead(A0), 0, 1023, -10, 10);

  Serial.print(x); // "-5"
  Serial.write('\t'); // '\t'
  Serial.println(y); // "10" + "\r\n"

  delay(2);
}

```

Should expect to send an output similar to this 1 on each of its **loop()**, right: ❔

```auto
String tsv = "-5" + '\t' + "10" + "\r\n";
println(tsv); // -5 10

int[] vals = int(splitTokens(tsv));
println(vals); // [0] -5 [1] 10

exit();

```

So AFAIK, a Processing Java code like this 1 should hopefully work for your case: 🥺

```auto
import processing.serial.Serial;

static final int VALS = 2;
int[] vals = new int[VALS];

void setup() {
  size(800, 600);
  noLoop();

  stroke(-1);
  clear();

  final String[] ports = Serial.list();
  printArray(ports);

  new Serial(this, "COM12", 115200).bufferUntil(ENTER);
}

void draw() {
  println(vals);
}

void serialEvent(final Serial s) {
  vals = int(splitTokens(s.readString()));
  redraw = true;
}

```

---

_[View the full topic](https://discourse.processing.org/t/using-two-different-readstringuntil-characters/10769)._
