The Electric Imp Reference Library contains classes to help you interface with external hardware, webservices, and accomplish a myriad of tasks!
We have split the Reference Library into 3 categories:
- Utility - Agent and/or Device libraries to simplify tasks such as persistant storage, building APIs, managing connections, and more!
- Hardware - Device libraries to simplify interfacing with external hardware, managing wifi connections, etc
- Web Services - Agent libraries that wrap external APIs such as Twitter, Xively, etc
We welcome contributions to the Electric Imp Reference Library. If you would like to contribute, please read and follow the guidelines listed below:
If you are adding a new library, please include it in the parent folder's README.md file (agent, hardware, web services).
All libraries must have their own folder (matching the library name) that contains the following files:
- README.md - Include a description of the library, the author, a hookup guide (if required), and sample usage.
- libraryName.device.nut (if device code is required) - The device code.
- libraryName.agent.nut (if agent code is required) - The agent code.
- Example folder (optional) - An example (if required).
The libraryName.device|agent.nut should contain the classes/tables associated with the library, and a sample instantiation, if a more complete example (or sample appliation) is required, it should be contained in an Example folder, with a similar structure to the library.
If your library includes an example, please use the following structure:
- README.md - Description of example, and a hookup guide (if required)
- libraryName.example.device.nut (if device code is required) - The device code.
- libraryName.example.agent.nut (if agent code is required) - The agent code.
- Other files as required - HTML, etc.
Please use the following cade conventions in your Squirrel:
- All lines should be semi-colon terminated
- e.g.
server.log("hello world");
- e.g.
- Constants should be ALLCAPS with underscores between words
- e.g
const MAX_SIZE = 12;
- e.g
- Class/Tables names should be UpperCamelCased
- e.g.
class ThisClass {
- e.g.
- Instantiated classes should be lowerCamelCased
- e.g.
thisClass <- ThisClass();
- e.g.
- Class/Table methods and properties should be lowerCamelCased
- e.g.
function publicMethod() {
- e.g.
- Class/Table methods and properties that should not be externally referenced should be prefaced with an underscore
- e.g.
function _privateMethod() {
- e.g.
- Digital out declarations should always use the seconds parameter (initial state)
- e.g
hardware.pin9.configure(DIGITAL_OUT, 0);
- e.g
Your code files should include the following:
- Copyright notice
- What license it falls under
- Link to license
// Copyright (c) 2014 Electric Imp
// This file is licensed under the MIT License
// http://opensource.org/licenses/MIT
All code in this repository (unless otherwise specificed in the file) is licensed under the MIT License.
See LICENSE.md for more information.