#define BITS 12
#define LED_BUILTIN 2
void setup(){
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
analogSetAttenuation(ADC_11db);
analogSetWidth(BITS);
ledcSetup(0,5000,BITS);
ledcAttachPin(LED_BUILTIN,0);
}
void loop(){
uint16_t val = analogRead(32);
Serial.printf("val=%u\n", val);
ledcWrite(0,val);
delay(1000);
}