GPIO2 is connected to ADC2, but ADC2 can’t be used at the same time as WIFi. Read this link and choose a GPIO pin that’s connected to ADC1…
Pete.