Disconnects the imp from the server and turns WiFi off
This method disconnects the device from the server and turns WiFi off. The imp will try to reconnect based on its current timeout policy:
If the SUSPEND_ON_ERROR policy is in effect, the imp will try to reconnect when any call is made that talks to the server, such as server.log().
If the RETURN_ON_ERROR policy is in effect, the imp will try to reconnect only when server.connect() is explicitly called by the device code.
The imp will always try to reconnect on a cold boot, irrespective of any timeout policy set so far.
Disconnecting the imp from WiFi frees a small amount of memory — about 3KB; the TCP send buffer — which re-connecting then re-uses. If the code disconnects WiFi, uses up nearly all the of the imp’s free memory and attempts to connect again, then there is a risk of it restarting with an out-of-memory error.
This example demonstrates how you can disconnect from WiFi and continue running code — in this case, blinking an LED. With this example you will need to power cycle your imp for it to reconnect.