Skip to content

Instantly share code, notes, and snippets.

@amcjen
Created October 14, 2017 07:21
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 amcjen/e6e74969eedb06e38a721c905ce3ec23 to your computer and use it in GitHub Desktop.
Save amcjen/e6e74969eedb06e38a721c905ce3ec23 to your computer and use it in GitHub Desktop.
Project Tonic Button Demo
const int ledPin = 13;
const int button1Pin = 2;
const int button2Pin = 3;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(button1Pin, INPUT_PULLUP);
pinMode(button2Pin, INPUT_PULLUP);
}
void loop()
{
if (digitalRead(button1Pin) == LOW || digitalRead(button2Pin) == LOW) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment