You can’t use ADC2 pins at the same time as WiFi.
Read this, and also take note of the “keep your void loop clean” comments too…
Pete.