Skip to content

Instantly share code, notes, and snippets.

@spilth
Created October 12, 2014 16:25
Show Gist options
  • Save spilth/b6fb8dbfd43cb26724ae to your computer and use it in GitHub Desktop.
Save spilth/b6fb8dbfd43cb26724ae to your computer and use it in GitHub Desktop.
Game Show Buzzer Code for https://vimeo.com/108712810
const int player1Button = A0;
const int player2Button = A1;
const int player1Led = 5;
const int player2Led = 9;
int player1ButtonState = 0;
int player2ButtonState = 0;
void setup() {
pinMode(player1Button, INPUT);
pinMode(player2Button, INPUT);
pinMode(player1Led, OUTPUT);
pinMode(player2Led, OUTPUT);
Serial.begin(9600);
}
void loop() {
player1ButtonState = digitalRead(player1Button);
player2ButtonState = digitalRead(player2Button);
if (player1ButtonState == HIGH) {
digitalWrite(player1Led, HIGH);
delay(1000);
digitalWrite(player1Led, LOW);
}
if (player2ButtonState == HIGH) {
digitalWrite(player2Led, HIGH);
delay(1000);
digitalWrite(player2Led, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment