Conflict between WiFi.h and analogRead

kherNI
Posts: 1
Joined: Thu Dec 22, 2016 2:59 pm

Conflict between WiFi.h and analogRead

Postby kherNI » Thu Dec 22, 2016 3:09 pm

If I don't #include <WiFi.h> my sketch runs fine with respect to testing out the analogRead function. The device is registering the proper analog signals on pins 12, 14, 26 & 27. Some are 0 and some vary with the value from a connected sensor, all are correct. However, if I #include <WiFi.h> in my sketch all analogRead values are maxed out (4096 values). The power supply is rated for 1A as I was thinking that might be a potential issue with the amount of power required for calibration and I even supplemented with another 0.5A supply but it didn't make any difference. Reloading the sketch with the #include <WiFi.h> removed restores proper functionality in the returned analogRead functions. Note that the only change in sketches is whether I #include <WiFi.h> or not and no other WiFi functions are called in the sketch. If I do initial an AP or STA mode those function correctly but problems still persist with the analogRead function.

Pargles
Posts: 1
Joined: Sat May 27, 2017 7:10 pm

Re: Conflict between WiFi.h and analogRead

Postby Pargles » Sat May 27, 2017 7:28 pm

Just in case someone else runs across this:

As per this post on github: https://github.com/espressif/arduino-esp32/issues/102

ADC1 pins can be used at the same time as WiFi.
ADC2 pins cannot work when WiFi is in use - not sure about BLE.

ADC1 GPIO pins: 32, 34 through to 39
ADC2 GPIO pins: 6, 7, 8, 10 through to 17

Who is online

Users browsing this forum: Baidu [Spider] and 33 guests