-->
Page 2 of 2

Re: Wi-Fi Reconnect

PostPosted: Thu Jun 01, 2017 6:04 am
by Joaquim Boavida
Hi,

Basically I query google.com, and if I got an empty string it means that i'm not connected to the internet (or google is down :lol: ) then reconnect

Code: Select all
if wget("www.google.com") == "" then
     gosub [reconnect]
....

[reconnect]
dim c_inf(2) as string
c_inf(1) = read("WIFIname")
c_inf(2) = read("WIFIpass")
wifi.connect(c_inf(1),c_inf(2))
undim c_inf
return



Not sure if is the best method..

Re: Wi-Fi Reconnect

PostPosted: Thu Jun 01, 2017 10:02 am
by faramon
Hi, this is my post about wifi reconnecting, mqtt and this kind of stuff. See it and copy connection reconnect code from my scripts..
http://www.esp8266.com/viewtopic.php?f=24&t=14433&p=64730#p64730
Faramon