#define POTENTIOMETER A0
#define LED 9
int potValue = 0;
void setup()
{
pinMode(POTENTIOMETER, INPUT);
pinMode(LED, OUTPUT);
}
void loop()
{
potValue = analogRead(POTENTIOMETER);
potValue = map(potValue, 0, 1023, 0, 255);
analogWrite(LED, potValue);
}