(The following line applies just to the ESP32. It defines that we want to be able to read voltage in full range. This means we want to read voltage from 0 to 3.3 V.)
what is this equivalent commend for Arduino IDE?
In the setup() try the following:
in which ADC_PIN corresponds to the GPIO you are getting the readings. The second argument can be one of the following:
(ADC_ATTEN_DB_0) 0dB attenuaton: gives full-scale voltage 1.1V
(ADC_ATTEN_DB_2_5) – 2.5dB attenuation gives full-scale voltage 1.5V
(ADC_ATTEN_DB_6) – 6dB attenuation gives full-scale voltage 2.2V
(ADC_ATTEN_DB_11) – 11dB attenuation gives full-scale voltage
Then, right after that add the following lines:
I hope this helps.