@liudr
the new code is this..but still the mouseY is not working and in the output window the value of mouseY is always 0..I didnt use the robotclass...
import processing.serial.*;
Serial myPort;
int valX,valY;
void setup()
{ background(0);
size(1024,1024);
myPort=new Serial(this,Serial.list()[0],9600);
}
void draw()
{ serialEvent(myPort);
mouseX=valX;
mouseY=valY;
fill(225);
ellipse(mouseX,mouseY,20,20);
if(mousePressed)
{background(0);
}
}
void serialEvent(Serial myPort)
{
String myString=myPort.readStringUntil(124);
if(myString!=null)
{
myString=trim(myString);
int inputs[]=int(split(myString,','));
if(inputs.length==2)
{ valX=inputs[0];
valY=inputs[1];
}
}
}