Controlling a stepper motor with a joystick

To make it easy for people to help you please modify your post and use the code button </>

so your code looks like this

and is easy to copy to a text editor. See How to use the Forum Your code is too long for me to study quickly without copying to a text editor.

Also use the AutoFormat tool to indent your code for easier reading,

There is probably a simple mathematical formula that would calculate the stepper value from the joystick value. I think this works

speedVal = ((X_VALUE - 520) / 31) + 1;

If you have a series of related IF statements it makes for a lot less typing if you use ELSE IF - like this

   if (!PUSH) {
            //1
         if(X_VALUE >= 520 )
        {
            stepper.setSpeed(1);
            stepper.step(1);
         }

            //2
        else if(X_VALUE >= 551)
         {
          stepper.setSpeed(2);
          stepper.step(1);
         }
         
         // etc
    }

...R