We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I want to get 5 numbers from Arduino at the moment, the Arduino program looks like this
void setup() { Serial.begin(9600); }
void loop() { Serial.println ("45 56 56 65"); }
This is my Processing programm, and it doesn't work for some reason
import processing.serial.*;
int data [];
Serial myPort; String val;
void setup () { size (400,400);
String portName = Serial.list()[0]; myPort = new Serial (this, portName, 9600); myPort.bufferUntil('\n'); }
void draw () {
}
void serialEvent (Serial myPort)
{
val = myPort.readStringUntil('\n');
val = val.substring(0, val.indexOf("\n"));
data = int(split(val, ' '));
}
Thank you for your help, Alex
Answers
found the issue
The idea in this forum is to share solutions as well as problems... :-)
It can help somebody else searching for a solution.
Sometime, the solution to this problem is to trim() the received string.