The code is for controlling the position of a continuous servo by attaching a potentiometer to it, I need an error margin so that it doesn't wobble from side to side and I don't know how.
void loop() {
if (mySerial.available()){
wntangle = mySerial.read();
}
potvalue = analogRead(potpin);
posangle = map(potvalue, 0, 1023, 0, 180);
if (wntangle > posangle){
servo1.write(80);
}
else if (wntangle < posangle){
servo1.write(100);
}
else{
servo1.write(90);
}
}