Reconciling Getting Started Tutorial with IDE

Newbie here. I’m trying to work my way through the Getting Started tutorial but it doesn’t correspond to the IDE I’m seeing in Chrome on Win7. In particular, there’s no Log pane (just Agent and Device) and no Build and Run button (just Build 1, Check, and Build buttons). The tutorial seems to be for a different version of the IDE. Can anyone offer some suggestions for how to learn how to use the Imp? Thanks.

You need to open the model and click the actual device - then you’ll see log windows and the right buttons. Because the same model can be on multiple devices, you need to select the actual device.

Though, there’s a long-standing bug I filed about “if there’s only one device, it should just auto-select that”, so maybe it’ll get fixed soon :slight_smile:

As far as I can tell, I’ve opened the model and selected the device. I see the Agent and Device panes and have pasted the sample blink code into the Device pane. Should I be able to do that if I haven’t selected the device? Still no Log pane or Build and Run button.

Above “build 1” should be a “devices” item. If you click this, do you see any devices listed?

Other way to do it is to see whether the icon to the left of the device name is an arrow pointing to the right (collapsed) or down (open). When open, the devices that below to that model are selected - these are the ones you need to click to access an individual device.

do you see any devices listed?

Yes, I see my device. When I click on it, the Agent and Device panes disappear and are replaced with a single window that says, “There is nothing to see yet. Click on a device to start editing.” When I click on my sole device, under Active Models, I’m returned to the previously mentioned two panes.

That’s…strange. Can you PM me a device ID? Never seen that before…

OK, so now the log shows up when I click on “devices” and select my device (I don’t know what’s changed). I also get the other buttons, and clicking on Build and Run sends the Blink program to the device and the LED in my test circuit blinks. However, I’ve had the device powered up (using an external adapter) continuously for a couple of days now and sometimes the LED blinks for awhile and sometimes it’s off. Turning on the PC tends to cause the LED to go off (if it was on when the PC was off), but not always, and even when it does turn it off, the LED will come on again spontaneously after awhile, and then go off just as spontaneously. Once you hit Build and Run, shouldn’t the LED blink forever until you turn off the power or write over the code? The behavior seems haphazard to me, but maybe I don’t understand how the whole system is supposed to work.

I’ve attached a screen grab of the IDE showing the log which shows the device disconnecting often, but no reason is given.

When you say “external adapter”, do you mean a usb charger or power from your PC or something else? Interesting that your log says “firmware update triggered”, but it doesn’t have the other messages that you would normally see after it.

A USB charger plugged into an AC outlet, so the April board and Imp receive power continuously.

The LED will only blink for 60s after a boot unless you do imp.enableblinkup(true) in your code. This is intentional.

However, you do seem to have a lot of wifi outages which essentially mean the imp lost contact with the server, couldn’t re-establish it within 60 seconds, and so then starting a loop of sleep for 9 mins, try for 1 min until it managed to reconnect. Seeing this on a good internet connection is most unusual. Are you using any wifi extenders or similar in your network?

Can you print your signal strength with server.log(imp.rssi()) ?

Thanks for the explanation, Hugo. Where is this 60 second limit documented? A superficial review of the code doesn’t suggest the LED should ever stop blinking. In fact, there are periods of blinking that are much longer than 60 seconds, without any sign of rebooting. Just to be safe, though, where in the sample code would I put imp.enableblinkup(true)?

The Imp is in the same room with (about four feet away from) the router (Netgear R7000 with three antennas) which covers the entire house with no problems. Attached is the output from the server.log(imp.rssi()).

60 seconds is documented back in release 10’s notes, which was where the behavior changed from being on all the time, but also alluded to here:

http://electricimp.com/docs/api/imp/enableblinkup/

You can put the call anywhere where it’ll run (near the top is fine). Not sure why you’re seeing it more unless you have power issues.

-26dBm is a pretty strong signal. Could you move it further away?

I’ll try moving it later. As for imp.enableblinkup(true), are there any potential side-effects to using it to keep the Imp awake? This doesn’t seem to be the intended use of this method.

Ah, I think there may be some confusion here :slight_smile:

I have been talking about the blinkup LED within the imp. The imp will remain running even when the LED stops flashing green. This is what enableblinkup does.

Looking at the code in your screenshot, you are flashing an external LED from squirrel. This will keep going unless the imp loses server connectivity, in which case the imp OS will attempt to reconnect, and sleep if it can’t. This will interrupt the flashing of your external LED because squirrel will stop running during these attempts.

If you use a different connection policy (RETURN_ON_ERROR) and add handlers for disconnections, then these reconnect attempts will happen in the background.

See http://forums.electricimp.com/discussion/1695/problem-with-the-reconnection-of-the-imp/p1 for some example code.