Arduino Leonardo as Mouse

I have an application in C # that sends XY coordinates for the Arduino, which should act as a mouse, returning movements to the PC. The problem is that the program sends, for example, the coordinate 250 300, but the Arduino does not control the mouse to point 250 300, will stop anywhere else. Does anyone have any solutions? My code is:

String xTexto = "";
String yTexto = "";
String XY ="";
int xNumero = 0;
int yNumero = 0;

void setup() {
//I did not know how to pass 2 parameters at the same time, so I send X, Y, and this function makes split (',') on 2 separate text variables

String getValue(String data, char separator, int index)
 int found = 0;
  int strIndex[] = {
0, -1  };
  int maxIndex = data.length()-1;
  for(int i=0; i<=maxIndex && found<=index; i++){
  if(data.charAt(i)==separator || i==maxIndex){
  strIndex[0] = strIndex[1]+1;
  strIndex[1] = (i == maxIndex) ? i+1 : i;
  return found>index ? data.substring(strIndex[0], strIndex[1]) : "";

void loop() {
    XY += char(;
  xTexto = getValue(XY,',',0);
  yTexto = getValue(XY,',',1);

  xNumero = xTexto.toInt();
  yNumero = yTexto.toInt();

  xTexto = "";
  yTexto = "";
  XY = "";

Are you aware that the moveTo() method sends relative data, not absolute data? Are you aware that even the relative data is interpreted by the OS and mapped to different coordinates that the active window can understand?

Your use of Strings and delays in reading data indicates that you are clueless about how serial data is actually sent (ssslllooowwwlllyyy). Having the sending application send an end-of packet marker, storing the serial data as soon as it arrives, and parsing and using the data only when the end of packet marker arrives would be far better. No need to piss away resources on Strings.

Actually I do not really know how things work, I'm taking a few codes here and there and trying to understand how everything fits together. Could you tell me if this what I want do is possible? If yes, you have a site so I can study and learn how to do it?

Could you tell me if this what I want do is possible?

No, I can't. I don't know what it is you want to do.

My program searches an XY coordinate specifies the screen and passes to arduino. The arduino should move the mouse to the corresponding position on the screen. Is this possible?

Is this possible?

Determine that for yourself. Have the Arduino ignore input. Just have it move the mouse to 4 different locations, with a pause in between.each move. When loop() is called again, does the mouse move to the same 4 locations?