Processing: Error, disabling serialEvent() for COM4 null

Hello everybody

I try to send variables from the arduino to processing. From time to time processing brings me this error:
Error, disabling serialEvent () for COM4 zero

I invite scetch again because then arduino, then it works partially. does anyone know what that is?

Simple Arduino Code:

int feld1=1;
int feld2=2;
int feld3=3;
int feld4=4;
void setup() {
 Serial.begin(9600);

}

void loop() {
 Serial.print(feld1); // Send the first Value
 Serial.print(','); // Send a delimiter
 Serial.print(feld2); // Send the first Value
 Serial.print(','); // Send a delimiter
 Serial.print(feld3); // Send the first Value
 Serial.print(','); // Send a delimiter
 Serial.print(feld4); // Send the first Value
 Serial.print(','); // Send a delimiter
 Serial.println(); // Send a carriage-return

}

Processing Code:

import processing.serial.*;  // Import the Processing Serial Library for communicating with arduino
Serial myPort;               // The used Serial Port
int feld1;
int feld2;
int feld3;
int feld4;
void setup()
{

  background(51);
  println(Serial.list()); // Prints the list of serial available devices (Arduino should be on top of the list)
  myPort = new Serial(this, Serial.list()[0], 9600); // Open a new port and connect with Arduino at 9600 baud
}
void draw(){
 print(feld1);
 print(feld2);
 print(feld3);
 print(feld4);
}

void serialEvent(Serial myPort) // Is called everytime there is new data to read
{
  if (myPort.available() > 0)
  {
    String completeString = myPort.readStringUntil(10); // Read the Serial port until there is a linefeed/carriage return
    if (completeString != null) // If there is valid data insode the String
    {
      trim(completeString); // Remove whiespace characters at the beginning and end of the string
      String seperateValues[] = split(completeString, ","); // Split the string everytime a delimiter is received
      feld1 = int(seperateValues[0]);
      feld2 = int(seperateValues[1]);
      feld3 = int(seperateValues[2]);
      feld4 = int(seperateValues[3]);
    }
  }
}

Unfortunately, I did not find any solution on google.

Thank you!

I try to send variables from the arduino to processing. From time to time processing brings me this error:
Error, disabling serialEvent () for COM4 zero

That's not an Arduino problem but a Processing problem. You should ask that on a Processing forum.

pylon:
That's not an Arduino problem but a Processing problem. You should ask that on a Processing forum.

If you do, you'll learn that you need to define when the serialEvent() method is called. You should add a call to myPort.bufferUntil() to define what character arriving triggers serialEvent().

PaulS:
If you do, you'll learn that you need to define when the serialEvent() method is called. You should add a call to myPort.bufferUntil() to define what character arriving triggers serialEvent().

can you help me with that? I'm still a total beginner.

try it for three hours and do not continue :frowning:

can you help me with that?

What do you need help with? I told you what method you need to call. I have no idea what you are sending from the Arduino to indicate the end of a packet, so I can't tell you what to use as the argument to that method.

The bufferUntil() method IS documented, on the Processing reference page.