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