C++ Potentiometers

I have learned to code all of the controls for the robot, but I still need to learn to code some sensors. I’m starting off with potentiometers. I’m coding in C++ and my goal is to use a potentiometers value to make a motor turn until it is within a specific range of values. If you need any clarification on the question just ask! Thanks in advance!