Imp.wakeup() not waking up

Hi everyone,

I have a server.disconnect() line at the beginning of my code so that my ImpExplorer takes humidity readings offline. It also has a deepsleep line in the middle of the code, so that the device can deepsleep between readings. I am using an imp.wakeup(2400, takereadingandsend) line a as a heartbeat signal. I never receive the heartbeat. Is it because everytime it deepsleeps the “2400” seconds counter starts again?

Thanks!

Yes. Per the documentation for imp.deepsleepfor():

When the imp enters deep sleep, the execution of Squirrel code is stopped entirely. When the imp wakes up, its device code is loaded from its flash storage and restarted.

…this is because deepsleep is the lowest power mode, and does not preserve RAM - hence there’s no context for the squirrel, and it starts again from the top.