Pin1 is hooked to a microphone. It wakes when I clap. Excellent. I was expecting it to have to connect to internet first. But instead it samples for 12 seconds! Collecting data about the sound that triggered it. Then the light turns Red. 5 seconds later it connects and sends my data via Wifi. That’s an unexpected Surprise! Please don’t take away this wonderful “Bug”…

//server.log("Begin"); local was=0,i,j,k=0; hardware.pin1.configure(ANALOG_IN); for(i=0;i<128;i++) {>>6; k+=math.abs(j-was) was=j; imp.sleep(0.1); } server.log(k); agent.send("update",k); hardware.pin1.configure(DIGITAL_IN_WAKEUP); imp.onidle(function() {server.sleepfor(8*60*60);} );

I’m not sure what you’re describing as a bug. On warm boot, whether from timer or pin1 wakeup, the imp does not fire up the Wifi until it’s first needed: in your case, that would be to perform the server.log(). If you comment back in the server.log that’s above the sampling, it will reconnect before doing the sampling.


That’s not a bug, that’s a feature! I like it.

Tell me if this is feasible? Let’s say there is no Wifi available. You can do some sampling, save to NV Ram, then go back to sleep? If you move the Imp to where there is Wifi temporarily, you can push the button I’ve wired telling it to continue in the code and look for Wifi. Will this work?

Or I can just wait for the next version release!

Should work, yes. In the current release, pushing the button to cause a server operation will commit the imp to looking for wifi – if none can be found, the imp eventually puts itself to sleep (without re-entering your code) and restarts later. The next release will offer more control over the process: with it, you can attempt to connect to wifi but go back to your logging loop if connection was unsuccessful.


If I knew when it was coming I can avoid this extra effort…

Current release: When it restarts in your scenario above, is it a warm start? Will it run my code before connecting like before? Every 10 minutes until it connects?