Downloading new code ... impExplorer

Hi, I have an impExplorer and I’m testing the demo refirgerator, but when I build and run some modification, the module does not load the new program, the “Downloading new code;” message in the log window does not appear. For this I need to turn the module on and off.

This is almost certainly because the impExplorer’s imp is in deep sleep when you click on Build and Run. At that point, it is disconnected from the server, so the ‘restart please’ message sent by the IDE to the impExplorer is not received, so you don’t see ‘Downloading new code’.

When the impExplorer wakes, it should connect and then it will receive the new application code. I don’t have the fridge example in front of me (got a link?) so I can’t say how long you’ll have to wait for the impExplorer to wake.

Hi Smitsmittytone, maybe its is happening
the code is here

and sorry is a Electric Imp Office Sensor Hub, not frigde.

even when de imp is online don´t Downloading new code, how can remove the deep sleep? i dont use batt

I’m pretty sure the issue is in the last part of the device code:

`while (true) {
    // Take a reading
    // Sleep 10 sec between readings

The imp.sleep() call blocks the CPU, so it’s not processing any messages from the server for the ten seconds the impExplorer is asleep — and that’s when you’re clicking ‘Build and Run’.

A much better way to do this to avoid blocking is to use the recommended approach and implement a timer. Replace the code above with the following:

`function loop() {
    // Take a reading

    // Wait 10 sec between readings
    imp.wakeup(10, loop);


This will cause readings to be taken every ten seconds, but without blocking the CPU.

PS. I’ve submitted a pull request to InitialState, so hopefully they’ll update their project code soon.

Thnks Smittytone, it was the cause, now the code is download when build and run !