Skip to content

Instantly share code, notes, and snippets.

@maxpromer
Last active May 25, 2017 17:39
Show Gist options
  • Save maxpromer/02aba65599e7c8a9158ef0d1f9dfaa05 to your computer and use it in GitHub Desktop.
Save maxpromer/02aba65599e7c8a9158ef0d1f9dfaa05 to your computer and use it in GitHub Desktop.
#define BTN_PIN 0
#define RELAY_PIN 13
void setup() {
pinMode(BTN_PIN, INPUT);
pinMode(RELAY_PIN, OUTPUT);
}
void loop() {
if (digitalRead(BTN_PIN) == LOW) {
while(digitalRead(BTN_PIN) == LOW) delay(10);
digitalWrite(RELAY_PIN, !digitalRead(RELAY_PIN));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment