Using a Potentiometer to control a stepper motor (stability problems)

Hi everyone!
For a electrical/electronic controls class I have in college, I've decided to use a arduino, and a easy stepper driver to control a stepper motor.

My project
-Im simulating a closed loop system for a stepper motor using two analog inputs (potentiometers). One input is set by a user, and one simulates a sensor.

My problem
-My pot is very unstable and the values fluctuate even when I'm not turning the pot!! How can I solve this problem?
-EVERYTING seems to be working FINE except for the unstablity with my pot. (which is a huge problem!)
-I will continue to strive to fix this problem. I would really appreciate any guidance, tips, advice on how to solve this problem!!
-Thank you all in advance!

MY CODE

int setpoint = A0;                          //Setpoint potentiometer. 
int setpointValue = 0;                      //Variable for setpoint potenetiometer value. 

int sensor = A1;                            // Sensor potentiometer. 
int sensorValue = 0;                        // Sensor Variable. 

int forREV = 11;                            //Pin 11 is FOR/REV. If high, foreward. If low, reverse. 
int Step = 10;                              //Pin 10 is step
int ledPin1 = 8;                            // Output for when setpoint value = sensor value. 
int ledPin2 = 9;
int ledPin3 = 7;                            //led is on when forREV is high. 
int ledPin4 = 6;                            //led is on when forREV is high.

int diff1 = 0;                              //Variable to store difference Value. 
int diff2 = 0;
int pos;                                    //Variable to store past postion.
int i;                                      //Variable to store counter value in for loops. 



void setup() 
    {                            
  pinMode(Step, OUTPUT);                    //Declare outputs.
  pinMode(forREV, OUTPUT);
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);
    }
    
void loop() 
    {
  setpointValue = analogRead(setpoint)/4;    // Read values from setpoint potentiometer.  

   diff1 = setpointValue - pos;              // Take difference betwen setpoint and past position.                     
  
if (diff1 > 0)                               //If the difference is greater than zero.
     {
    abs(diff1);                              //Take the absolute value of the difference.
    digitalWrite(forREV, HIGH);              //Set pin 11 high (forward). 
    digitalWrite(ledPin3, HIGH);
    digitalWrite(ledPin4, LOW);
    
    for(i= diff1; i > 0; --i)                //Decrement variable i and loop until i = 0.        
     {
    digitalWrite(Step, HIGH);                //Step. 
    delay(50);
    digitalWrite(Step, LOW);
    delay(50);
     }
     }
else if (diff1 < 0)                          //If the difference is less than zero. 
     {                                       //Do nothing if difference = 0. 
     abs(diff1);                             //Take the absolute value of the difference. 
     digitalWrite(forREV, LOW);              //Set pin 11 low (reverse).
     digitalWrite(ledPin3, LOW);
     digitalWrite(ledPin4, HIGH); 
     
     for(i= diff1; i > 0; --i);              //Decrement variable i and loop until i = 0. 
     { 
     digitalWrite(Step, HIGH);               //Step.
     delay(50);
     
     digitalWrite(Step, LOW);
     delay(50);
     }
     }

      pos = analogRead(setpoint) /4;          //Read the setpoint potentiometer and store in the past position varaiable.     

      setpointValue = analogRead(setpoint);   // Read values from setpoint potentiometer and the sensor potentiometer.  
      sensorValue = analogRead(sensor);
  
      diff2 = setpointValue - sensorValue;    // Take the difference of the setpoint and sensor values
      
      abs(diff2);                             // Take the absolute value of the difference
  
if (diff2 >= 0 && diff2 < 30)                 // Compare the difference to a upper and lower limit
      {      
     digitalWrite(ledPin1, HIGH);             // If the diff is within the desired range, turn on green led
     digitalWrite(ledPin2, LOW);
      }
else 
      {                                       // If the diff is not within the desired range, turn off green and turn on red LED. 
     digitalWrite(ledPin1, LOW);   
     digitalWrite(ledPin2, HIGH);
      }
}

Add a capacitor from the analogue input to ground to remove interference.

Thanks! Any ballpark estimates for the size?

I tried building a low pass filter on the input of my pot. I still am having problems! Im using a voltmeter to measure the drop across one side of my pot (ground to my A0 input) and the voltage is fluctuating! This is why! I wiggled the pot a little and there is a intermittent loose connection.

Im going to try and solder wires onto the pot instead of having it sit directly on my breadboard.

Just tried my above possible solution, and it helped...but the problem is still intermittent.
Should I look for a better potentiometer?

What values the pot, 10K is the optimal value.
If you can see the voltage fluctuations then the capacitor needs to form a filter to take them out, so you work out the maths with the pot value to give you a capacitor value. The time constant T is simply the value of the capacitor times the resistor as measured in ohms and Farads.
Always solder up circuits bread boards are rubbish. So eliminate all the bread board from your setup.