Stabilize a mapped ADC value

Ok so after headache after headache with Nextion libraries not working much at all, I decided to get back to roots and do it the simple way. The code below reads a pot, maps its adc, constrains it and then updates a serial write section that names the value, provides the value and finally writes an ending code 0XFF three times.

It works wonderfully with no lag, but I noticed that if you fall on the edge of a mapped zone, the value will jiggle back and forth between two numbers. Im curious what I should use to disregard sending a reading unless its gone up or down by more than 1? Basically, allow it to update as fast as necessary when the value is going up or down quickly, but stick to one number once it has stopped?

Here is the code

      int realspeed = 0;
      int sensorPin = A0;  // Potentiometer pin to simulate an rpm sensor, for testing
      int sensorValue;  // Variable to store the value of potentiometer

    void setup() {

    Serial.begin(9600);
    Serial.print("baud=115200");
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);

    Serial.end();

    Serial.begin(115200);
    }
    void loop() {
      

     sensorValue = analogRead(sensorPin);  // Read analog pin where the potentiometer is connected
  realspeed = map (sensorValue, 0, 1023, 0, 200);  // Remap pot to simulate a speed value
  realspeed = constrain(realspeed, 0, 200);  // Constrain the value so it doesn't go below or above the limits
    
    Serial.print("n0.val=");
    Serial.print(realspeed);
    Serial.write(0xff);
    Serial.write(0xff);
    Serial.write(0xff);

    
    
    }

EDIT Im thinking it would be like a debounce process, but the fact that it is bouncing constantly, I cant think of a way to actually pay attention to a particular number. Maybe I need to average it?

Im curious what I should use to disregard sending a reading unless its gone up or down by more than 1?

Compare the current value with the previous value which you have saved to a variable and ignore it if it has not changed by more than 1

UKHeliBob:
Compare the current value with the previous value which you have saved to a variable and ignore it if it has not changed by more than 1

Ahh, so something like deadband for servos to limit hunting?