You will have better luck using the ADC command, the POT command is not always best. And make sure the variable resistor is linear, it will be easier to code for.