const int potPin = A0;
const int ledPin = 9;
int potValue = 0;
int pwmValue = 0;
void setup(){
pinMode(ledPin , OUTPUT);
Serial.begin(9600);
}
void loop(){
potValue = analogRead(potPin);
pwmValue = map(potValue , 0 , 1023 , 0 , 255);
analogWrite(ledPin , pwmValue);
Serial.print("Potentiometer Value: ");
Serial.print(potValue);
Serial.print(" -> ");
Serial.print("PWM Value: ");
Serial.println(pwmValue);
//delay(1000);
}