Slide Potentiometer values for LED intensity

Hi,



I am trying to use the Grove - Slide Potentiometer to control the intensity of a LED (max 255). What is the the max analog read value? (modify script based on <LINK_TEXT text=“http://www.toptechboy.com/arduino/lesso … ntiometer/”>http://www.toptechboy.com/arduino/lesson-11-arduino-circuit-to-dim-led-with-potentiometer/</LINK_TEXT>. Any other code is welcome as with the http://wiki.seeedstudio.com/Grove-Slide_Potentiometer/ code I get this error “error: ‘gt’ was not declared in this scope”



code:
[code]int potPin= A0; //Declare potPin to be analog pin A0
int readValue; // Use this variable to read Potentiometer
int intensityValue; // Use this variable for writing to LED

void setup() {
pinMode(potPin, INPUT); //set potPin to be an input
Serial.begin(9600); // turn on Serial Port
}

void loop() {
readValue = analogRead(potPin); //Read the voltage on the Potentiometer
intensityValue = (255./716.) * readValue; //Calculate Write Value for LED
Serial.print("You are writing a value of "); //for debugging print your values
Serial.println(intensityValue);

}[/code]

Hi,



The Arduino Uno has ADC have a resolution between readings of 5 volts / 1024 units or, 0.0049 volts (4.9 mV) per unit.



and control the LED by the Pot better, you can use the map() function.

</s>map(value, fromLow, fromHigh, toLow, toHigh) <e>