I,m working on an idea ith an ESP32 with 3 sensors checked via RTOS tasks and status reported via WiFi.
One sensor is temperature (Dallas) and another is movement (PIR) both works fine. The third is light connected to an ADC pin and that’s where the truoble is. It works as long as I don’t start a WiFi connection but if I do it will only show 4096 as a value. I have tried different pins with the same result, correct values will only show up when the WiFi i unused.
Hi Anders.
I think you’re having a conflict between analogRead() and using the WiFi library at the same time.
You can find the same issue here and some suggestions: https://github.com/espressif/arduino-esp32/issues/102
It seems that you can only use ADC1 GPIOs when using Wi-Fi. ADC2 GPIOs conflict with the WiFi library.
Can you try using ADC1 GPIOs to your analog sensor and see if the issue is resolved?
You can check the ESP32 pinout here: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ scroll down to the “Analog to Digital Converter (ADC)” section and chose an ADC1 GPIO.
Let me know if this solves your issue.
Regards,
Sara