Load the Code
There are some things you’ll need to do before you can load code into your Imp Explorer. You don’t have to print any of the plastic parts or build the anemometer to get started, but you do need to do the following:
- Get an account on the Imp IDE (they’re free).
- Connect your Imp Explorer to your WiFi network using Electric Imp’s “BlinkUp” app on an iPhone, iPad or Android phone.
- Find your Imp in the IDE and assign it to a “Model”, the Impish term for a particular program.
Follow the instructions in the Imp Explorer Getting Started Guide to do all that. I encourage you to work all the way through the examples in the guide as you’ll be much more comfortable with the IDE if you do. (Besides, you have time to kill while your printer is cranking out all those .stl files).
Create a new model called WxImp and assign your device to it, just as you did with the example code you created while following the Getting Started Guide.
Next, get the WxImp code from Github. If you’re not already familiar with Github, just click on the green “Clone or Download” button, then click “Download ZIP“.
Unzip the archive and use your favorite text editor to copy device.nut and paste that into the right-hand side of the Electric Imp IDE. The contents of agent.nut should be pasted into the left side.
The language in which Electric Imp code is written is named “squirrel”. There is no fixed extension required for squirrel code. You could use .txt, but somehow .nut seems more appropriate for squirrel, so lots of the example code for squirrel uses that file extension.
Pressing the “Build and Run” button will compile the code and push the device code into the Imp SD card in your Imp Explorer and set up a web page created by the agent code where you can see the results. The Development Device Logs window at the bottom of the IDE screen shows log entries from either the agent.nut code or the device.nut code. Just above the log there is a link to the web page created by the agent code.
If you look at the log you will see a number of lines the begin “server.log(….)”. These are output to the log along with some information such as the sleep and connect/disconnect messages that get logged without explicit code references. You’ll notice that there are many server.log() lines in orange type that are “commented out” these will produce log output if you remove the “//” that starts those lines.
Try experimenting with modifications to the code. If things go terribly wrong you can always reload the original code from the downloaded zip archive.
Check GitHub frequently for code updates.