Skip to content

Instantly share code, notes, and snippets.

@ElectricImpSampleCode
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElectricImpSampleCode/b159409d8ba63e28e699 to your computer and use it in GitHub Desktop.
Save ElectricImpSampleCode/b159409d8ba63e28e699 to your computer and use it in GitHub Desktop.
An example of a simple main program loop written in an impOS-friendly way.
function loop() {
// Get an integer reading from the imp's light sensor and relay it via UART
uart57.write("Current light level is: " + hardware.lightlevel() + "\r\n");
// Set the imp to check again in two seconds' time
imp.wakeup(2.0, loop);
}
// Start of program
// Initiate main loop
loop();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment