Problem with reconnect wifi

Hey, guys! I'm having a problem that I don't know why or if there is a solution. When I run the skecth below on ESP32 with broadband internet in my house, the wifi connects and if I disconnect and reconnect the connection, it reconnects automatically. But, if I use the 4g internet routed from my Smartphone, the wifi connects, but if I disconnect and connect again, it still appears as "disconnected" and WiFi.status() goes from 6 to 0, which respectively is : WL_DISCONNECTED and WL_IDLE_STATUS and does not connect again.

#include <WiFi.h>

void setup() {
  // put your setup code here, to run once:
  WiFi.begin("mywifi", "password");


void loop() {
  // put your main code here, to run repeatedly:
  if(WiFi.status() == WL_CONNECTED)
    Serial.print("STATUS: ");

Does anyone know why the same code behaves differently on different networks?

I don't know if the problem could be the ESP hardware, the router or the actual code...

I tried to look for situations similar to mine, there are several reports but no conclusion or solution.



This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.