So I suspect you are not reading the pin that the pot is actually connected to but without ALL the code I can't say.