Resetting a potentiometer

I have programmed a potentiometer to give me the heighest number of degrees it turned. But I want to reset it to a default value using a limit switch. any ideas on how to do that?

You can’t physically reset the pot in software but you can use the limit switch to learn a “home” position and thereafter subtract home from the current reading to derive an absolute position.

If the pot will rollover (from max R to 0 and back) things get a little tricker. You’l have to maintain your own “index”, index = how many times pot has rolled over and increment/decrement the index as the pots rolls forward or backwards though its zero point.