Example Code
This is a collection of examples written for the Electric Imp platform. Not all code in this repository is actively maintained, so please submit pull requests if you make improvements to the example code.
Microsoft Azure Examples
Microsoft Azure IoT Central Asset Tracking Demo
In this example, you begin by learning the basics of working with Electric Imp. We will use Electric Imp Libraries to seamlessly connect imp-enabled hardware to Azure IoT Central. Your imp-enabled hardware device will report telemetry and location data through the Electric Imp impCloud into Azure IoT Central. This example uses an impC Breakout Board plus Pixhawk GPS and/or an impExplorer to implement a Asset Tracking demo with IoT Central.
Updated Nov 12, 2018
MS_IoTCentral_Temp_Stack_Light_PLC_Demo
This example uses an impAccelerator Fielbus Gateway and the Electric Imp Modbus Library to monitor the temperature via a Click PLC. The temperature data is sent to Microsoft Azure using the Electic Imp AzureIoTHub libray and can be monitored using Azure IoT Central.
Updated April 16, 2018
AzureTwins Library
AzureTwins is a library, that helps you work with Azure Twins API. It supports full set of operations provided by the service.
Updated Feb 24, 2018
Recent Examples
CellularAssetTrackerExample
This is software for a low power cellular asset tracker based on the impC001 breakout board. The tracker monitors for movement, and if movement has been detected it will report daily, otherwise the device will report once a week sending GPS location, battery status, and movement status.
Updated April 18, 2019
RemoteTerminal
Example code for a secure remote serial console
Updated April 2, 2019
SWDFlasher-STM32
SWDFlasher-STM32 is an imp application that can be used to flash the STM32F100 MCU. Its agent downloads a firmware image via HTTPS and then transmits it to the device, which uses the SWD protocol to program the MCU.
Updated March 9, 2019
Bluetooth BlinkUp
Sample code demonstrating BlinkUp™ via Bluetooth LE on imp004m.
Updated Oct 24, 2018
Apple Watch
Control Electric Imp Platform-based Internet of Things devices from your Apple Watch.
Updated Sep 6, 2018
BLE iBeacon
These examples show how to use the imp API hardware.bluetooth to create iBeacon advertisers and listeners. These examples use 2 imp004m breakout boards with w1, w2, w5, and w7 connected to enable bluetooth. One imp004m creates an iBeacon formatted advertisement and broadcasts it via the imp API hardware.bluetooth. The other imp004m uses the imp API hardware.bluetooth to scan for iBeacons with the same UUID that the the first imp is broadcasting. One example shows a passive scan, the other uses an active scan to broadcast device state info using a scan response.
Updated February 19, 2019
Intro to Squirrel Applications
A series of eight examples for use with the sensors on the impExplorer Developer Kit, impAccelerator Battery Powered Sensor Node or impC001 Breakout Board Kit. These examples range from simple to advanced programming. Each example builds on the skills learned in the previous example. Please note that the first few examples are not power efficient and will drain battery powered devices quickly.
Updated August 18, 2018
impMonitor
This example demonstrates the use of the impCentral™ API to retrieve information about your development devices and use that data to generate a live web-based status readout via HTML, JavaScript and jQuery.
Updated March 01, 2018
searchXML
This example contains a function used for searching for a specific path within an XML string. It supports sibling tags with the same name but does not support nested tags with the same name. It can be used synchronously or asynchronously and the README contains examples of both.
Updated November 16, 2017
Thermocouple
This example has simple code for reading temperature from a thermocouple click board and also an application that sends temperature data to Initial State. The thermocouple runs on 3.3v. The range of the thermocouple is -270 to 1372 degrees celsius. These examples are written for use with an impAccelerator Fielbus Gateway, but can be easily modified for use with any imp.
Updated Sept 11, 2017
ArduCAM OV2640 Example
This example contains a facial recognition application and a driver class for the OV2640 ArduCAM. The camera driver can be used to develop other camera applications. The facial recognition application uses the Kairos Facial Recognition API to detect and recognize faces. To run this application you will need to set up an account on Kairos.
Updated August 24, 2017
GoogleCalendar
This is example code for using the imp with Google Calendar. The example provided allows you to schedule turning on lights on the device (an imp explorer kit) by adding an event titled "lights" to your calendar. The example code, however, also provides methods within a GoogleCalendar class which let you schedule, modify, delete, and view events from your calendar. By setting them up with device.on
calls from the agent and device.send
calls from the device, you can perform these actions by interacting with the device as well.
Updated August 9, 2017
Arrow Imp005 EZ Eval Examples
Examples for use with the Imp005 EZ Eval board.
Updated June 30, 2017
SensorNode_BatteryCheck
This example was written for the Battery Powered Sensor Node to determine the battery voltage. The battery class included in this example can be used for other devices as long as there is an analog pin that is connected directly to the battery. Please note this code is not usable for determining the battery voltage on the impExplorer Developer Kit, since no analog pins are connected directly to the battery.
Updated June 21, 2017
FieldbusGateway_TempPLC
This example uses an impAccelerator Fielbus Gateway and the Electric Imp Modbus Library to monitor the temperature via a Click PLC.
Updated May 26, 2017
WirelessGateway_LoRaBall
This example transmits accelerometer data from an Arduino Feather with a LoRa RH_RF95 to an impAccelerator Wireless Gateway with a LoRa RN2903 radio.
Updated May 26, 2017
FactoryFixtrure_SensorNodeTesting
This example contains an example of factory firmware code. It uses an impFactory™ as the factory fixture and impAccelerator™ Battery Powered Sensor Nodes as the devices being tested and produced.
Updated May 26, 2017
SensorNode_BasicEnvExample
This example shows a low power application for the ImpAccelerator Battery Powered Sensor node that takes environmental sensor readings.
Updated May 25, 2017
FieldbusGateway_PumpPLC
This example uses an impAccelerator Fielbus Gateway and the Electric Imp Modbus Library to contol and monitor a pump via a Click PLC.
Updated May 25, 2017
SX1509
The SX1509 class interfaces with the SX1509 IO expander. It sits on the I2C bus and data can be directed to the connected devices via its I2C address. Interrupts from the devices can be fed back to the imp via the configured imp hardware pin.
Updated Aug 21, 2018
Instructables Code
tempBug
Updated February 28, 2015
emma
This code remains a primarily as a reference for emma reference design.
Updated December 15, 2014
SnackBot
This example uses an imp to control the motor on a snack dispenser. The agent serves a webpage with a form used to dispense candy.
Updated June 2, 2014
turkeyprobe
Updated January 23, 2014
thermalprinter
Build an internet-connected thermal printer with an electric imp. Instructable code.
Updated January 22, 2014
Older Examples
imp002-EVB
This example code is intended to be used with the imp002-EVB guide on the Electric Imp Developer Center.
Updated April 14, 2015
factory_process
Outdated factory code example.
Updated January 23, 2015
flora
This code remains a primarily as a reference for flora reference design.
Updated January 23, 2015
becky
This example uses Input/Output Ports, which have been replaced by Agents and HTTP request-based communication. This code will not work as currently written, but remains primarily as a reference for older designs.
Updated December 15, 2014
ekho
This example uses Input/Output Ports, which have been replaced by Agents and HTTP request-based communication. This code will not work as currently written, but remains primarily as a reference for older designs.
Updated December 15, 2014
jane
This example uses Input/Output Ports, which have been replaced by Agents and HTTP request-based communication. This code will not work as currently written, but remains primarily as a reference for older designs.
Updated December 15, 2014
kaylee
This example uses Input/Output Ports, which have been replaced by Agents and HTTP request-based communication. This code will not work as currently written, but remains primarily as a reference for older designs.
Updated December 15, 2014
nora
This example uses Input/Output Ports, which have been replaced by Agents and HTTP request-based communication. This code will not work as currently written, but remains primarily as a reference for older designs.
Updated December 15, 2014
quinn
This example uses Input/Output Ports, which have been replaced by Agents and HTTP request-based communication. This code will not work as currently written, but remains primarily as a reference for older designs.
Updated December 15, 2014
tails
Example code for 9dof and env sensor tails.
Updated November 13, 2014
sana
The Sana reference design implements an internet-connected universal remote.
Updated November 3, 2014
vanessa
FutureStack Badge reference code.
Updated November 3, 2014
dreamforce-2014
These examples were used for Dreamforce 2014 workshops.
Updated October 12, 2014
SimpleTextToSpeech
This is a very basic TTS example intended to demonstrate the absolute bare minimum to get up and running with audio.
Updated August 14, 2014
audio
This example shows a simple example of how to wrap the Fixed-Frequency DAC class to play back analog waveforms, and a simple example of how to wrap the Sampler class to record analog waveforms.
Updated July 21, 2014
pcd8544
Updated July 9, 2014
lala
Lala is a battery-powered audio recording and playback impee with 4MB onboard SPI flash memory. Lala is designed as a starting point for building an asynchronous message delivery system, like an intercom
Updated June 17, 2014
weatherunderground
Updated June 6, 2014
hannah
This code remains a primarily as a reference for hannah reference design.
Updated June 5, 2014
olive
Olive is a reference design for an RFID/NFC reader connected to an Electric Imp. The example here is not complete reference code.
Updated June 5, 2014
RGBLed
This example demonstrates how to set the color of an RGB LED based on data received via an incoming HTTP request.
Updated June 2, 2014
charlie_the_chimpee
Updated June 2, 2014
hexbug_spider
Updated June 2, 2014
kelly
Updated June 2, 2014
lalavoicerecorder
This Lala Voice Recorder is a simple wifi voice recorder.
Updated June 2, 2014
lavender_pos
Electric Imp's Point of Sale Demo.
Updated June 2, 2014
meeting_minder
Updated June 2, 2014
tasha
Updated June 2, 2014
yahoo_finance
Updated June 2, 2014
PingPong
This is a sample application used to demonstrate how to pass messages between device and agent. It can also be used to view latency times of the Electric Imp platform.
Updated May 28, 2014
Shelf
The goal of the shelºF project was to build a smarter internet connected thermostat system.
Updated May 28, 2014
vc0706
Updated May 19, 2014
Cowbell
This example demonstrates how to trigger a solenoid whenever an incoming HTTP request is received. In our example, the solenoid strikes a cowbell!
Updated May 15, 2014
HelloWorld
This example demonstrates basic digital IO.
Updated May 15, 2014
IoTButton
This example demonstrates how we can make a web request to any URL when a button is pressed. In this example, we're making a request to our Internet-Connected Cowbell
Updated May 15, 2014
PowerSwitchTail
This example demonstrates how to control a PowerSwitch Tail II from an HTTPS endpoint. In this example, we've also implemented a basic agent webpage, and some "security" (a password field that must match).
Updated May 15, 2014
RequestCounter
This example counts incoming requests (based on a particular key) and reacts in two ways: it moves a servo to the left or right to indicate a Tug-Of-War and it displays the number of 'left' and 'right' requests that have come in since the code started running.
Updated May 15, 2014
tempBug-KeenIO
This example demonstrates how to send temperature data to Keen IO every minute.
Updated May 15, 2014
holiday_lights
Updated February 11, 2014
janice
Updated January 8, 2014
offlinelogging
Updated November 6, 2013
loggly
Updated October 7, 2013
License
These examples are licensed under the MIT License.