Running Imp's code with WIFI turned off

Hello,
I’m on a project where we must use the minimum energy possible. In order to reduce Imp’s consumption due to the WIFI connection, we need to work with the Imp disconnected from the WIFI and only connect to it once per hour to upload the collected data.
Is there any function that can help me?

Thank you,
Rui Lopes.

Absolutely, the Imp is great at this. Take a look at the functions in the following example code:

if (server.isconnected()) { // If WiFi is connected server.expectonlinein(30); // Disconnect, and let the server know we should be back in 30 seconds } //Do stuff imp.onidle(function() { //Whenever the device is not busy doing something server.expectonlinein(30); //Schedule disconnect and sleep imp.deepsleepfor(25); });

Ignore the warning messages about sleeping.

You should absorb and digest this: https://electricimp.com/docs/resources/wifistatediagram/

and then look at, for example, this: https://electricimp.com/docs/api/imp/deepsleepfor/ whose example sounds like just what you’re looking for.

In particular, don’t forget that any command that talks to the server, such as server.log, will by default bring the connection back up again!

Peter