|
楼主 |
发表于 2022-9-28 11:16
|
显示全部楼层
详细原因在https://arduino.stackexchange.com/questions/84888/analog-read-not-working-while-using-wifi
The ESP32 has two ADCs. One of them, ADC2, is actively used by the WiFi.
From the IDF documentation:
Since the ADC2 module is also used by the Wi-Fi, only one of them could get the preemption when using together, which means the adc2_get_raw() may get blocked until Wi-Fi stops, and vice versa.
That means you can't use the ADC on any of the ADC2 channels while WiFi is on: GPIO4, GPIO0, GPIO2, GPIO15, GPIO13, GPIO12, GPIO14, GPIO27, GPIO25 and GPIO26.
But you can use ADC1, which uses pins GPIO36, GPIO37, GPIO38, GPIO39, GPIO32, GPIO33, GPIO34 and GPIO35. |
|