Created
October 12, 2014 16:25
-
-
Save spilth/b6fb8dbfd43cb26724ae to your computer and use it in GitHub Desktop.
Game Show Buzzer Code for https://vimeo.com/108712810
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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