Stepper motor losing its position

I cannot see anything wrong with the code you have written.

It is possible that turning the knob fast causes spurious readings from the pot, but even then, your code should still work.

Is there some limit on the number which the function argument "steps" can be ?