I’m trying to send data from Arduino to Processing. Three data are sent by Arduino which separated by comma (like 616, 224, 1200), and is split and stored. The data can be read and printed by Arduino Serial monitor properly. But in processing, sometimes the running is interrupted by the error "Error, disabling serialEvent() for COM15. null ". The screen capture is below:
We can see the latest data lose commas and some digits.
The code for processing is below:
import processing.serial.*;
Serial myPort; // The serial port
void setup () {
println(Serial.list());
myPort = new Serial(this, Serial.list()[2], 115200);
myPort.bufferUntil('\n');
}
void draw () {
}
void serialEvent (Serial myPort) {
String inString = myPort.readString();
if (inString != null) {
String[] list = split(inString, ',');
println(inString);
String IBI = list[2];
}
}
Can anyone help me about this?
Thanks!