Is it being pulled over a roller or pulley so you can measure the number of rotations of the roller? A simple quadrature encoder will do this easily. US Digital make some really nice absolute encoders that will allow you to measure the rope down to fractions of a millimeter.If it's being pulled past a window, perhaps the sensor out of an optical mouse can be used?
Hello, what do you mean with the US Digital encoder? Is it possible to use a pulley with a potentiometer?
A rotary encoder puts out a series of pulses that your sketch must interpret as the pulley rotation.I suggested a couple of ways to get pulses from the turning pulley.dave-in-nj suggested another way to get one pulse per rotation.
put a reflective dot on the pulley and count rotations with an ir transmitter
In this case the accuracy will be too low.