Can't connect to Wifi automaticly Unless i reboot ESP32

Nas Ro
Posts: 3
Joined: Mon Jul 25, 2022 11:19 am

Can't connect to Wifi automaticly Unless i reboot ESP32

Postby Nas Ro » Mon Jul 25, 2022 11:26 am

Hi, This is may first Time using ESP RM
it work's well but every time when i lost WIFI connection i need to reboot My ESP
1. is there a way to activate Auto connect
2. How can i activate Local control using Arduino IDE

sanketwadekar
Posts: 32
Joined: Tue Jul 26, 2022 10:08 am

Re: Can't connect to Wifi automaticly Unless i reboot ESP32

Postby sanketwadekar » Tue Jul 26, 2022 4:00 pm

To auto connect to WiFi, you can create an event handler function like this.

Code: Select all

void WiFiEvent(WiFiEvent_t event, arduino_event_info_t info){
  switch(event){
    case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
      Serial.println("Disconnected from station, attempting reconnection");
      WiFi.reconnect();
      break;
    default:
      break;
  }
}
And then in setup() function of Arduino, add the following statement.

Code: Select all

WiFi.onEvent(WiFiEvent);
I have tried and tested this on ESP32 using Arduino 1.8.3

Nas Ro
Posts: 3
Joined: Mon Jul 25, 2022 11:19 am

Re: Can't connect to Wifi automaticly Unless i reboot ESP32

Postby Nas Ro » Wed Jul 27, 2022 11:33 am

Yes it's work for me thank you
what about activate local control using Arduino IDE is that option available :?:
i see it here but can't understand who can i use it using Arduino IDE
https://rainmaker.espressif.com/docs/local-control.html

Who is online

Users browsing this forum: No registered users and 39 guests