#define pot 36 //Pin de ESP32 donde conecto la salida del potenciometro
#define led 13 //Pin de ESP32 donde conecto la resistencia y el LED

int lectura;
int brillo;

const int freq = 5000;
const int ledChannel = 0;
const int resolution = 8;

void setup()
{
Serial.begin (9600);
// Configuracion funcion LED PWM
ledcSetup(ledChannel, freq, resolution);

// adjunte el canal al GPIO para ser controlado
ledcAttachPin(led, ledChannel);
}
void loop()
{

lectura = analogRead(pot);//Asigancion de la lectura a la variable

brillo = map(lectura, 0, 4095, 0, 255);//Mapeo de la variable

ledcWrite(ledChannel, brillo);

Serial.print("VALOR: ");
Serial.print(lectura);
Serial.print(" BRILLO: ");
Serial.println(brillo);

delay(100);
}
$abcdeabcde151015202530354045505560fghijfghij