Relative Content

Tag Archive for apierror-handlingarduinowifiesp32

ESP32 Wifi Connection and POST API: Error code: -1 when WiFi reconnected

been trying to figure out a code for an ESP32 to send a POST API every 10seconds.
The code sucessfully connects to the Wifi and receive status 200 for every POST it does on the first connection. However, if I force the wifi off and turn it on again sometimes I receive a “HTTPClient initialized, Error code: -1” everytime, and then cannot make it work again.
Only method to make it work again is if I reupload the code to the ESP. Then it reconnects again and succeeds on the API calls.