Using Slider to move mouse but mouse pointer shakes

I want to use two sliders to control moving the mouse around on the screen. I understand it's not easy to take control of the normal mouse on a PC to do this. I don't mind using another component to move the mouse around.

This is a relatively simple task and I do have it working using a slider for X and a slider for Y axis.

The problem is that the mouse pointer shakes in place...I would says its moving quickly within about 1/32 of an inch but its moving quick rapidly. I'm sure because of the Loop().

How can I stop the shaking of the mouse pointer?

Thank you...

Here is my code:

#define SLIDERX   A1
#define SLIDERY   A2

int sliderValueX = 0;
int sliderValueY = 0;

int mouseX = 0;
int mouseY = 0;
int x = 0;
int y = 0;

void setup() {
  //Serial.begin(9600);
  Mouse.screenSize(1920, 1080);  // configure screen size         
}

void loop(){
  x = analogRead(SLIDERX);
  mouseX = x;    
  y = analogRead(SLIDERY);
  mouseY = y;
  Mouse.moveTo(mouseX, mouseY);  
  //Serial.print(mouseX);
  //Serial.print("x");
  //Serial.println(mouseY);
  delay(25);
}

I have not seen the functions anywhere yet

Mouse.screenSize(1920, 1080);  // configure screen size         
Mouse.moveTo(mouseX, mouseY);

What Arduino are you using? Which library?

As far as I understand, there is no moveTo in the mouse interface, all movements are relative to the current position.

I'm actually using the Teensy board because they support moveTo(x,y). I thought maybe the basic mouse pointer positioning may be the same and a fix for the Ardunio board might work with the Teensy board.

Do you have a link to the library?

The jitter is probably in the analogRead(). Try adding averaging or hysteresis.

The problem is that the mouse pointer shakes in place

If it does not shake when given fixed values then the problem is probably in the analogue input reading or your processing of it.

I went with software averaging and that seemed to work ok…thanks to all…