const int potPin = A0;
const int pinLed = 6;
void setup() {
pinMode(potPin, INPUT);
pinMode(pinLed, OUTPUT);
}
void loop() {
int potValue = analogRead(potPin);
int brightness = map(potValue, 0, 1023, 0, 255);
analogWrite(pinLed, brightness);
delay(100);
analogWrite(pinLed, LOW);
delay(100);
}