by Felipe Felipe
Check, every 1 minute, if there is a known (previously connected) wifi in range. If positive, it will connect to it and turn data Off. If not, it enables data.
It also contains a time window variable, used for when you go to sleep and turn your Wifi Off it will not be turned back on during that period.