Controlling a stepper motor with a joystick

a more elegant way would start by indenting the code.

and

getting rid of useless empty

lines..

this is unreadable.. (press ctrl-T in the IDE..)


To your question, you could either find a formula that maps the analogRead to the value you want or have the thresholds in an array and use a for loop to find where you are