Arduino -> Processing Serial problems

Ok, i want to send x,y,z values (in one line) from my arduino to processing over serial then use split() on the string value and then display it ect…

arduino sends this :


Processing receives it like this:



Problem is this doesn’t work, processing wont accept the one line value therefore i cant split or use the values .

is there any other sketch that works or another solution?

Could you post your current arduino code ?

I dont think it the arduino code is wrong , (on the arduino serial window its being displayed correctly) Its the processing code that the string comes incomplete.

processing code import processing.serial.*;

int lf = 10;    // Linefeed in ASCII
String myString = null;
Serial myPort;  // Serial port you are using
String num1;
int ok1=1;
int ok2=2;
int x=0;
void setup() {
  myPort = new Serial(this, Serial.list()[1], 9600);


void draw() {
  while (myPort.available() > 0) {
    myString = myPort.readStringUntil(lf);
    if (myString != null) {
    //print(myString);  // Prints String


  if (x==0){

Post your arduino code as well and I'll have a play with it.

I noticed "//print(myString); // Prints String" in your code. What do you mean by this ?

println uses "," (comma) as a seperator and will inset a line break. You probable want "print" instead, but I'm not sure what the statement above means.

Actually i fix it D:

The problem was "myPort.clear();" that what was breaking my prints

Your processing sketch should have a myPort.bufferUntil() call, to define when a packet has been received. If the Arduino is sending a value, a comma, a value, a comma, a value, and a carriage return/line feed, processing should buffer data until the carriage return is received.

The Processing sketch should also have a serialEvent() method that gets called when the buffer until character arrives. The serialEvent() method should contain the code to parse the input.