Skip to content

Instantly share code, notes, and snippets.

@cat-haines
Created October 28, 2015 01:30
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 cat-haines/0ed6bba5530a25baa75e to your computer and use it in GitHub Desktop.
Save cat-haines/0ed6bba5530a25baa75e to your computer and use it in GitHub Desktop.
Hello World example for Electric Imp
led <- hardware.pin9; // LED Pin
ledState <- 0; // Current state of the LED
// Configure the LED
led.configure(DIGITAL_OUT, ledState);
function blink() {
// run blink() again in half a second
imp.wakeup(0.5, blink);
// Flip the state, and write it to the pin
ledState = 1 - ledState;
led.write(ledState);
}
// Call blink() to start the loop
blink();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment