user3663: I'm using my Arduino Leonardo as a Mouse but I'm experimenting a strange behaviour.
I put my mouse at (-1, -1) (absolute) coordinates and then I execute this code:
Move.move(com[curr_cmd_id].x, com[curr_cmd_id].y, 0);

where that point is (334, 180) (relative coords) (and I checked it through Serial console)
Now, the pointer is actually moving to the right but then it stops. Let's say it reaches the point (334, 0).
Then I tried:
Mouse.move(com[curr_cmd_id].x, 0, 0);
delay(500);
Mouse.move(0, com[curr_cmd_id].y, 0);

but still the same behaviour.
Then finally I tried this one (which it actually solves my problem but it's a dirty solution):
int i;
for(i=0; i<com[curr_cmd_id].x; i++){
  Mouse.move(1,0,0);
  delay(1);
}
for(i=0; i<com[curr_cmd_id].y; i++){
  Mouse.move(0,1,0);
  delay(1);
}

Could anybody help me in understanding what's going on here? How can I achieve a simple and direct relative movement for my pointer?
Thanks you in advance!!

user5116: I struggled with this too until I realized this

Parameters
xVal: amount to move along the x-axis - signed char
yVal: amount to move along the y-axis - signed char 
wheel: amount to move scroll wheel - signed char

Note it says signed char.
That means the value you pass to the Mouse.move is a signed 8-bit. (-128 to 127)
My work around is this below:
void moveMouse(int x, int y, int w){
  x = (int)x / 1.59; //Adjust these two values accordingly. I found out that 100, 100 does 
  y = (int)y / 1.58; //not move 100, 100. It moves 159, 158 for me.

  while(x!=0 || y!=0 || w!=0){
    int moveX, moveY, moveW;
    if(x > 0){
      if(x >= 100){
        moveX = 100;
      }else{
        moveX = x;
      }
    }else if (x < 0){
      if(x <= -100){
        moveX = -100;
      }else{
        moveX = x;
      }
    }else{
      moveX = 0;
    }

    if(y > 0){
      if(y >= 100){
        moveY = 100;
      }else{
        moveY = y;
      }
    }else if (y < 0){
      if(y <= -100){
        moveY = -100;
      }else{
        moveY = y;
      }
    }else{
      moveY = 0;
    }

    if(w > 0){
      if(w >= 127){
        moveW = 127;
      }else{
        moveW = w;
      }
    }else if (w < 0){
      if(w <= -128){
        moveW = -128;
      }else{
        moveW = w;
      }
    }else{
      moveW = 0;
    }

    x = x - moveX;
    y = y - moveY;
    w = w - moveW;

    Mouse.move(moveX, moveY, moveW);
  } 


3663: <p>I'm using my Arduino Leonardo as a Mouse but I'm experimenting a strange behaviour.
I put my mouse at (-1, -1) (absolute) coordinates and then I execute this code:</p>

<pre><code>Move.move(com[curr_cmd_id].x, com[curr_cmd_id].y, 0);
</code></pre>

<p>where that point is (334, 180) (relative coords) (and I checked it through Serial console)</p>

<p>Now, the pointer is actually moving to the right but then it stops. Let's say it reaches the point (334, 0).</p>

<p>Then I tried:</p>

<pre><code>Mouse.move(com[curr_cmd_id].x, 0, 0);
delay(500);
Mouse.move(0, com[curr_cmd_id].y, 0);
</code></pre>

<p>but still the same behaviour.</p>

<p>Then finally I tried this one (which it actually solves my problem but it's a dirty solution):</p>

<pre><code>int i;
for(i=0; i&lt;com[curr_cmd_id].x; i++){
  Mouse.move(1,0,0);
  delay(1);
}
for(i=0; i&lt;com[curr_cmd_id].y; i++){
  Mouse.move(0,1,0);
  delay(1);
}
</code></pre>

<p>Could anybody help me in understanding what's going on here? How can I achieve a simple and direct relative movement for my pointer?
Thanks you in advance!!</p>
 5116: <p>I struggled with this too until I realized this</p>

<blockquote>
  <p>Parameters</p>
  
  <p>xVal: amount to move along the x-axis - signed char</p>
  
  <p>yVal: amount to move along the y-axis - signed char </p>
  
  <p>wheel: amount to move scroll wheel - signed char</p>
</blockquote>

<p>Note it says signed char.</p>

<p>That means the value you pass to the Mouse.move is a signed 8-bit. (-128 to 127)</p>

<p>My work around is this below:</p>

<pre><code>void moveMouse(int x, int y, int w){
  x = (int)x / 1.59; //Adjust these two values accordingly. I found out that 100, 100 does 
  y = (int)y / 1.58; //not move 100, 100. It moves 159, 158 for me.

  while(x!=0 || y!=0 || w!=0){
    int moveX, moveY, moveW;
    if(x &gt; 0){
      if(x &gt;= 100){
        moveX = 100;
      }else{
        moveX = x;
      }
    }else if (x &lt; 0){
      if(x &lt;= -100){
        moveX = -100;
      }else{
        moveX = x;
      }
    }else{
      moveX = 0;
    }

    if(y &gt; 0){
      if(y &gt;= 100){
        moveY = 100;
      }else{
        moveY = y;
      }
    }else if (y &lt; 0){
      if(y &lt;= -100){
        moveY = -100;
      }else{
        moveY = y;
      }
    }else{
      moveY = 0;
    }

    if(w &gt; 0){
      if(w &gt;= 127){
        moveW = 127;
      }else{
        moveW = w;
      }
    }else if (w &lt; 0){
      if(w &lt;= -128){
        moveW = -128;
      }else{
        moveW = w;
      }
    }else{
      moveW = 0;
    }

    x = x - moveX;
    y = y - moveY;
    w = w - moveW;

    Mouse.move(moveX, moveY, moveW);
  } 
</code></pre>
