I’m relative newbie to Arduino programming, but have a programing background. I’m trying to combine 2 sketches. One to gather Temp, Humidity and pressure from a BME280 sensor. The second is to read DC voltage through one of the ADC2 pins. The 2 individual sketches work fine on their own. When the 2 sketches are combined, the analogRead command always reads 4096 regardless whether connected to a power or not. Is what I’m trying to do possible? if so, what am I doing wrong?
Howdy,
Does your project use WIFi? Because there is a known pbm on the ADC2 pins when used in conjunction with WiFi:
- https://github.com/espressif/arduino-esp32/issues/440
- https://github.com/espressif/arduino-esp32/issues/102#issuecomment-295272351
As a reminder, here is a list of pins to consider:
https://desire.giesecke.tk/index.php/2018/01/30/adc2-channel-cannot-be-used-when-wifi-is-in-use/
Rui and Sara also reference a pin map of the WROOM-32 module:
As well as a declination on the DoIt ESP32 DevKit v1:
Hopefully that’s where your problem lies.
Regards,
Steph
Yes, my sketch does have a wifi component. And yes, using one of ADC1 pins worked. Thanks for your help.