I understand that using wifi wipes out some of the pins on the ESP32 (I can not remember which, help?).
However what would be great is to be able to connect wifi and then disconnect it. wifi.disconnect does not seem to work.
I heard there was a way round it using esp_wifi but I can’t figure out how to find our install this correctly.
At present when i use wifi a whole load of pins stop working.
Can you help out?
When you use wi-fi, you cannot use analog input on ADC 2 pins.
When you say that wifi.disconnect() is not working, what do you mean?
After calling WiFi.disconnect() you can print the Wifi status with: WiFi.status()
Which pins stop working when using wifi and what functionalities are you trying to use on those pins?
Hi Sara, before connecting wifi in the sketch the analogue pins I am using only report a value of 4095 when before they were functional.
What I wanted to do was connect wifi and then disconnect it, so I can use the pins as before. After calling wifi.disconnect, the problem continues. On searching on the web, i see others have had this issue. Apparently es_wifi_disconnect() needs to be used, but I am not sure how to implement that.
The pins I am using are 12, 14, 13, 39, 26, 15, 32, 27, 12, 23. Some of these are used as analogue pins and some enable power to sensors, so it will take a bit of digging to determine which is out, but some of these use ADC2. What I would like to do is use the pins, gather data, switch wifi on, report data, disconnect wifi and reuse the pins, but the issue is once wifi has been used once, wifi.disconnect does not release the pins. Do I need to resassign then perhaps or can I use a different disconnect command?
ps you guys do an awesome job!
You’re using a lot of ADC2 pins. Those won’t work when the Wi-Fi is on.
I’ve searched about disconnecting Wi-Fi to read the ADC2 pins, and it seems that you need to call some commands after disconnecting WiFi to make the ADC2 work again.
I’ve read about it here: https://github.com/espressif/arduino-esp32/issues/102#issuecomment-496284224
You also need to include:
I haven’t tested this, but accordingly to the comments on the forum, it should work.
Alternatively, you can consider using ADC1 pins.
I hope this helps and thank you for following and supporting our work.
Many thanks. I will look into that, but I have avoided the problem for now by changing rounds some pins and only use ADC1 for alanogue.