mouse control with potentiometer

this the code i use:
int potpin=0;

void setup(){
}
void loop(){
int x=map(analogRead(0),0,1023,1365,0);
Mouse.move(x,0,0);
}

whe i move the potentiometer the mouse cursor moves from 0 to 1365 only nothing between how can i solve this i am using arduino leonardo

how can i solve this

Make sure your potentiometer is connected correctly. Serial.print() the value read from the pin. Of course, this means that you can't call analogRead() in the map() call, but you shouldn't be doing that, anyway.

Serial.print() the mapped value. Is it what you expect?

PaulS:

how can i solve this

Make sure your potentiometer is connected correctly. Serial.print() the value read from the pin. Of course, this means that you can't call analogRead() in the map() call, but you shouldn't be doing that, anyway.

Serial.print() the mapped value. Is it what you expect?

No need to print the value.. He is using the Leonardo. He can just continue using the Mouse library.
Scratch that.. Didn't read your post fully..

The arguments to Mouse.move() are relative positions, not absolute positions. Since your code writes movement commands to the Mouse every time round loop your potentiometer is essentially controlling the speed of the mouse, not the position. Given that you are moving it a large distance every time round loop() and loop() is running frequently (there is very little to slow it down) the mouse will obviously zoom off the the edge of the screen straight away.

If you want the potentiometer to control the mouse position then you need some indirection between the potentiometer and the mouse commands.

Firstly, read the potentiometer position however often you want and use your map() call to calculate the corresponding mouse target position.

Compare that to the previous mouse target position to work out when it has been moved. You might need to do some smoothing here or you might not - try it without first.

Finally, send the Mouse a command to move it by however far the target position has moved.

Note that at startup you don't know the initial position of the mouse. You can either assume that it starts at the mid point (and let the desktop constraints deal with that if you try to move it off the edge of the screen) or quickly move it to the limits in both directions and then re-center it at startup.