I'm using a 5k pot as an angle sensor for a robor arm joint, but I'm getting unstable readings (+- 2)
you can use multiple readings and average them
value = 0;
for (int i=0; i< 16; i++) value += analogRead();
value /= 16;
or use a lowpass filter
value = value - 0.1 * (value-analogRead()); // same as value = 0.9 * value + 0.1 * analogRead(); but optimized.
Difference the lowpass filter makes the system less responsive, and only needs one analogRead().