Hi all, I need help with the following code:
Since the Arduino number 1 sent the following data:
12 @ 34% 56/78) 91 & 23. At the end of the sentence ended with a point, and I separate the variables with rare characters:
In the Arduino number 2, where these data are received, it is where I have the problem:
With java, would put the following code, but do not quite see Arduino works:
void serialEvent (Serial port) {
valor = port.readStringUntil('.');
valor = valor.substring(0, valor.length() - 1);
index1 = valor.indexOf('@');
index2 = valor.indexOf('%');
index3 = valor.indexOf('/');
index4 = valor.indexOf(')');
index5 = valor.indexOf('&');
p1boton = valor.substring(index1+1, index2);
ypos1 = valor.substring(index2+1, index3);
p1ypos = Integer.parseInt(ypos1);
p2boton = valor.substring(index4+1, index5);
ypos2 = valor.substring(index5+1, valor.length());
p2ypos = Integer.parseInt(ypos2);
Which it makes this part of the program is to collect all data and separate them, but in C ++ (in Arduino code), I don't know which is the code.
The would greatly appreciate a little help !!!
Thanks!