rotary potentiometer 5Kohm to measure distance

Hi Gents
ive got a uno model and i want to move a encoder around to measure distance.
the code below works well but i need to move the encoder around few times to dim light.(example 10 times.But the anolog out is the same as the anolog in .I need multi anolog in rotation to give out 0 to 5 volts out.

//Controlling led by potentiometer
//Rotate the shaft of the potentiometer and you should see the luminance of the LED change.
//Email:info@primerobotics.in
//Website:www.primerobotics.in
//2015.5.7
//
const int analogPin = 0;//the analog input pin attach to
const int ledPin = 9;//the led attach to
int inputValue = 0;//variable to store the value coming from sensor
int outputValue = 0;//variable to store the output value
/
/
void setup()
{
Serial.begin(9600);//set the serial communication baudrate as 9600
}
/******************************************/
void loop()
{
inputValue = analogRead(analogPin);//read the value from the potentiometer
Serial.print("Input: "); //print "Input"
Serial.println(inputValue); //print inputValue
outputValue = map(inputValue, 0, 1023, 0, 255); //Convert from 0-1023 proportional to the number of a number of from 0 to 255
Serial.print("Output: "); //print "Output"
Serial.println(outputValue); //print outputValue
analogWrite(ledPin, outputValue); //turn the LED on depending on the output value
delay(1000);
}

but i need to move the encoder around few times to dim light.(example 10 times.But the anolog out is the same as the anolog in .I need multi anolog in rotation to give out 0 to 5 volts out.

It is unclear, to me, what you want and what you have. You mention a potentiometer and an encoder. Those are not the same things. And you mention that you want to measure distance, but in the code, there is only dimming a light. How do you propose to measure distance with a potentiometer?

A complete schematic of what you have with all connections, power supplies and part numbers (and/or links to data sheets) would help a lot.

Plus a detailed description of the project.

Read the how to use this forum-please read sticky to see how to properly post code and some advice on how to ask a question so that we have the information to be able to help you.

ok what iam trying to do is the analog input must rotate 0 to 5 vdc 10 times because it over laps the voltage.the analog output must read 0 to 5 vdc only.

image1.JPG

Post a well lighted and focused picture of that round, white thing or copy and post all of the lettering and numbers on it.

picture of encoder

image1 (2).JPG

Looks like a 5k precision pot (with no endstops). If you are giving it multi-turns, then you can count the turns (and direction) by counting when the voltage goes from 0 to 5V (or thereabouts) when it has been more slowly changing from 5V to 0V, and vice versa, but with a bit of effort, a user could fiddle that simple solution. For reliability and longer service life, I reckon a rotary encoder would be better.