Lose data from serial port

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:
processing_Error
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!

1 Like
1 Like

Thanks so much for your help! But actually I’ve found the reason which is the hardware. Thanks anyway!

Hello,

Hardware issues are always of interest to me.
Can you share what it was?

:slight_smile:

1 Like

Sure! I soldered the USB TTL cable to an Arduino Nano, and connect the USB TTL cable to another USB extension cable to PC. I think the problem is from soldering or cable connection, because I’ve tested with the jump wire, there’s no data losing any more.

1 Like