void setup() {
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(9, OUTPUT);
}

void loop() {
int analogInputVal = analogRead(A0);
int brightness =255 - map(analogInputVal, 0, 1023, 0, 255);
analogWrite(9, brightness);
Serial.print("bright=");
Serial.println(brightness);
delay(10);
}
$abcdeabcde151015202530fghijfghij