-
• #2
This is what I use
function wifiConnect() { wifi = require('Wifi'); wifi.connect(wifi_options.ssid, { password: wifi_options.password }, (e)=> { if (e) { print("WIFI: " + e); } }); wifi.on('connected', ()=> { print('WIFI:', wifi.getIP()); }); wifi.on('disconnected', ()=> { print("WIFI: Reconectando..."); wifi.connect(wifi_options.ssid, {password: wifi_options.password}); }); }
-
• #3
Perfect, thanks a lot! I did not expect the
disconnected
event to trigger whenconnect()
fails.
Hello,
Does anybody have a solid method to automatically restore the Wifi connection on an ESP32 after losing it, for instance after a router reboot?
Thanks a lot!
Regards,
Ronald