Last active
August 29, 2015 14:16
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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