ESP32 Analog Pin 4 Value 连接WIFI后刷新失败

ESP32 Analog Pin 4 Value Failed to refresh after WIFI is connected

不明白为什么ESP32 pin 4的光敏电阻接10kohms的模拟值在WIFI智能配置完成后无法刷新,一直保持在最大值4095。

另一方面,如果源代码中没有WIFI智能配置相关编码,则4脚输入的模拟值会刷新

int sensorPin = 4;    // select the input pin for the potentiometer
int ledPin = 13;      // select the pin for the LED
int sensorValue = 1000;  // variable to store the value coming from the sensor
#include <WiFi.h>

void setup() {
  // declare the ledPin as an OUTPUT:
  Serial.begin(115200);


 WiFi.mode(WIFI_AP_STA);
  WiFi.beginSmartConfig();
  Serial.println("Waiting for Smart Config");

  while (!WiFi.smartConfigDone()) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("Smart Config Done");
  //*Wait for WiFi to connect to AP
  Serial.println("waiting for WiFi");

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("WiFi Connected");
  Serial.print("IP Address ");
  Serial.println(WiFi.localIP());


}

void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  Serial.println(sensorValue);

  delay(sensorValue);

}

日志

0:40:35.846 -> 
20:40:35.846 -> rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
20:40:35.846 -> configsip: 0, SPIWP:0xee
20:40:35.846 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
20:40:35.846 -> mode:DIO, clock div:1
20:40:35.846 -> load:0x3fff0018,len:4
20:40:35.846 -> load:0x3fff001c,len:1100
20:40:35.846 -> load:0x40078000,len:10088
20:40:35.846 -> load:0x40080400,len:6380
20:40:35.846 -> entry 0x400806a4
20:40:36.215 -> Waiting for Smart Config
20:40:36.719 -> ..............................................................................
20:41:15.217 -> Smart Config Done
20:41:15.217 -> waiting for WiFi
20:41:15.724 -> ..WiFi Connected
20:41:16.233 -> IP Address 192.168.1.7
20:41:16.233 -> 4095
20:41:20.333 -> 4095
20:41:24.427 -> 4095

不刷新WIFI日志

20:43:16.964 -> 3115
20:43:20.077 -> 3121
20:43:23.196 -> 3122
20:43:26.298 -> 2971
20:43:29.272 -> 1886
20:43:31.159 -> 3109

只需将传感器引脚更改为 GPIO 36 或 39 或 ADC1 上的任何引脚 运行,因为模拟监听输入将解决 WIFI 上拉问题