Skip to content

Instantly share code, notes, and snippets.

@eddieespinal
Created December 11, 2014 18:40
Show Gist options
  • Save eddieespinal/d4bec399f71c4c8b4d33 to your computer and use it in GitHub Desktop.
Save eddieespinal/d4bec399f71c4c8b4d33 to your computer and use it in GitHub Desktop.
Electric Imp Push button logic
// configure the button
button <- hardware.pin1;
button.configure(DIGITAL_IN_PULLUP, function() {
imp.sleep(0.05); // software debounce
local state = button.read();
// button down
if (state == 1) {
server.log("button is pressed");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment