Both of the sensors you have linked are potentiometers. The first allows 10 turns of rotation and then stops. The second can only be turned within a 300 degree arc. If that fits your requirements then the potentiometer tutorial has all the information you need.