const int potPin = 32;
const int outPin = 5;
int potValue = 0;
void setup(){
Serial.begin(115200);
pinMode(outPin, OUTPUT);
delay(500);
}
void loop(){
potValue = analogRead(potPin);
Serial.print("Giá trị của biến trở: ");
Serial.print(potValue);
Serial.print(" - ");
Serial.print(map(potValue, 0, 4095, 0, 100));
Serial.println("%");
analogWrite(outPin, map(potValue, 0, 4095, 0, 100));
delay(1000);
}