The code for the project is furnished below. The analog values read from the joystick are printed to the serial monitor to see the rest state and movement state values and set the values in the program accordingly.
void setup()
{
pinMode(A0,INPUT);
pinMode(A1,INPUT);
}
void loop()
{
int x = analogRead(A0); //A1
int y = analogRead(A1); //A2
if(y < 310)
Mouse.move(0,-10,0);
else if(y > 325)
Mouse.move(0,10,0);
else
Mouse.move(0,0,0);
if(x < 330)
Mouse.move(-10,0,0);
else if(x > 340)
Mouse.move(10,0,0);
else
Mouse.move(0,0,0);
delay(100);
}