I have been trying to find documentation or code samples on how to do this and gave not come across anything that makes much sense. All I need to do is put the impexplorer in deepsleep until the humidity sensor reads more than 60%. If it reaches that threshold, it needs to wake up and run other code which I have and works well. Any ideas or suggestions?
The HTS221 sensor doesn’t have the ability to sample and compare against a threshold; however, as humidity changes relatively slowly, it’s pretty power efficient to poll.
To do this, at wake you would read the sensor and if it was below the threshold, go back to sleep. If you don’t do any logging or message sending at that point, the imp will not attempt to bring up wifi and hence the wake (and hence power impact) will be minimal.
If the threshold is reached - or, say, once per day, you then force a connection with an agent.send. Periodic connections are good to make the device pick up new code if you’ve pushed it whilst the device was offline - eg you may want to change the threshold. Remember to wrap your imp.deepsleepfor call in an onidle call to ensure that the device will notice new squirrel from the server.
However, the page on sleep states appears to have a problem so I can’t link to the docs. Paging @smittytone …