Hi All,
When thinking about this project, I was immediately brought back to work and my students. Teachers in my building are constantly playing jeopardy as a review and the kids always argue about who buzzed in first. I wanted to try and solve that issue, so I created a simple buzzer. It could be built out with more switches and LEDs, but I went with two for now. Anything to reduce the bickering and increase the learning is great for students and teachers. 🙂
Here’s a video:
Here’s the code:
It’s super simple, but it gets the job done.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
void setup() { // put your setup code here, to run once: pinMode(7, OUTPUT); pinMode(8, OUTPUT); pinMode(9, INPUT); pinMode(10, INPUT); } void loop() { // put your main code here, to run repeatedly: //if switch on pin 9 is pressed first the attached LED lights up. if (digitalRead(9) == HIGH && digitalRead(10) == LOW) { digitalWrite(7, HIGH); delay(5000); } //if switch on pin 10 is pressed first the attached LED lights up. else if (digitalRead(10) == HIGH &&digitalRead(9) == LOW) { digitalWrite(8, HIGH); delay(5000); } //if neither switch is pressed, neither light up. else { digitalWrite(7, LOW); digitalWrite(8, LOW); } } |