

There is a very good video explaining these functions that you can watch here. Get the result of the conversion: returns 16-bit integer. Check if conversion on the pin’s ADC bus is currently running (returns TRUE or FALSE). adcStart(pin), adcBusy(pin) and resultadcEnd(pin): starts an ADC convertion on attached pin’s bus.adcAttachPin(pin): Attach a pin to ADC (also clears any other analog mode that could be on).Attenuation values are the same from previous function. analogSetPinAttenuation(pin, attenuation): sets the input attenuation for the specified pin.ADC_11db: The input voltage of ADC will be attenuated, extending the range of measurement to up to approx.ADC_6db: The input voltage of ADC will be attenuated, extending the range of measurement to up to approx.ADC_2_5db: The input voltage of ADC will be attenuated, extending the range of measurement to up to approx.ADC can measure up to approximately 800 mV (1V input = ADC reading of 1088). analogSetAttenuation(attenuation): sets the input attenuation for all ADC pins.analogSetClockDiv(attenuation): set the divider for the ADC clock.It has an effect of increasing sensitivity. analogSetSamples(samples): set the number of samples in the range.analogSetCycles(cycles): set the number of cycles per sample.It can be a value between 9 (0 – 511) and 12 bits (0 – 4095). analogSetWidth(width): set the sample bits and resolution.analogReadResolution(resolution): set the sample bits and resolution.There are other more advanced functions to use with the ADC pins that can be useful in other projects.

So, if you’re using Wi-Fi and you’re having trouble getting the value from an ADC2 GPIO, you may consider using an ADC1 GPIO instead, that should solve your problem. Note: ADC2 pins cannot be used when Wi-Fi is used. This means that when you read an analog input, its range may vary from 0 to 4095. These analog input pins have 12-bit resolution. Learn more about the ESP32 GPIOs: ESP32 Pinout Reference.
