Set slide potentiometer values I am using the Grove - Slide Potentiometer (http://wiki.seeedstudio.com/Grove-Slide_Potentiometer). How can I set the potValue so that at maximum it will 128?

int potPin= A0;   
int readValue;   
int potValue;  

void setup() {
  pinMode(potPin, INPUT);   
  Serial.begin(9600);       
}

void loop() {
 readValue = analogRead(potPin);   
 potValue = (255./500.) * readValue;  
 Serial.print("You are writing a value of ");   
 Serial.println(potValue);
}
analogRead() returns 0x0000 to 0x03ff

If the max data 0x03ff is shifted to the right by 3 bits (or divide by 8), 
then 0x03ff becomes 0x007f, or 127.

I think this will do it:

desiredMax = analogRead(A0) &gt;&gt; 3; // divide 1023 max by 8, becomes 127 max