const int potPin = A0;
const int ledPin = 9;
int potValue = 0;
int ledValue = 0;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
potValue = analogRead(potPin);
ledValue = map(potValue, 0, 1023, 0, 255);
analogWrite(ledPin, ledValue);
Serial.print("Potentiometer Value: ");
Serial.print(potValue);
Serial.print(" | LED Brightness: ");
Serial.println(ledValue);
delay(100);
}