int LED = 12, POT = 4;
int PotValue, Brightness;
void setup() {
pinMode(LED,OUTPUT);
Serial.begin(115200);
}
void loop() {
PotValue = analogRead(POT);
Brightness = map(PotValue,0,4095,0,255);
analogWrite(LED, Brightness);
Serial.print("ค่าความสว่าง: ");
Serial.println(Brightness);
delay(1000);
}