Looking for a Digital Potentiometer

Could you not utilise a digital rotary encoder on a digital pin?