#define pinPot 26
#define LED_BUILTIN 12
int lecturaPot;
int potValor;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(pinPot, INPUT);
pinMode(LED_BUILTIN, OUTPUT);
ledcAttach(LED_BUILTIN, 5000, 8);
}
void loop() {
// put your main code here, to run repeatedly:
lecturaPot= analogRead(pinPot);
potValor=map(lecturaPot,0,4095,0,255);
ledcWrite(LED_BUILTIN,potValor);
Serial.println(potValor);
delay(100); // this speeds up the simulation
}