const int potPin = A0;
const int ledPin = 11;
int nilai;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(potPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
nilai = analogRead(potPin);
nilai = map(nilai, 0, 1023, 0, 255);
analogWrite(ledPin, nilai);
Serial.print("Nilai Potensiometer : ");
Serial.println(nilai);
}