Electric Imp Developer Wiki
Software that runs on the imp is written in Squirrel: a high level object oriented programming language with a syntax similar to C or JavaScript. More background is in Wikipedia's article on Squirrel.
The official Squirrel language documentation can be found at squirrel-lang.org (the imp uses a slightly modified version of Squirrel 3.0.4): Squirrel Reference Manual
All Squirrel programs on the imp will need to use at least some of the Electric Imp API, the objects and classes that encapsulate the imp hardware and its internet connection. Some may also need parts of the Squirrel standard libraries, also documented at squirrel-lang.org: Squirrel Standard Libraries Manual
Several example Squirrel programs, from the simplest-possible to the somewhat advanced, are provided on this wiki.
There are a few differences between the standard Squirrel libraries and imp Squirrel's libraries. The biggest one is that the Squirrel math library is in its own namespace, math. So where the official Squirrel documentation talks about, say, acos(), on an imp that would be math.acos(). Other differences are more minor and relate to operations that can't work on an imp: all the file handling calls, for instance, have been removed, as there's no filesystem on an imp.
| Present on the imp | Absent from the imp | |
|---|---|---|
| Base library | getroottable assert print error array type callee dummy | setroottable getconsttable setconsttable compilestring newthread suspend setdebughook seterrorhandler getstackinfos |
| IO library | all (except for stream methods on blobs) | |
| Blob library | all | |
| Maths library | all, but in namespace math, see above | |
| System library | clock time date | getenv system remove rename |
| String library | all except regexp class | regexp class (but will be added in a future release) |
In a few places Squirrel has been extended in ways intended to benefit users of imps and/or agents:
if (“X” in Y) construct now works even if Y has a delegate, or a metamethod getif (“pinA” in hardware)