zwatts

I spend part of the summer vacation building a quiz system that I can use in the classroom (I'm a science teacher). The buzzers are basically simple buttons and the processing sketch does most of the work.

Don't know if we can embed youtube but here it is in action: http://www.youtube.com/watch?v=QXka_UJgBVcAll files are available here.

Coincidentally, I just saw a similar system at instructables.com (was poking around waiting for the forum to re-open) using Staples Easy buttons.http://www.instructables.com/id/Quiz-O-Tron-3000-Arduino-quiz-contestant-lockout-/That one doesn't have the PC software to display scores tho.

How do you sample when buttons are pressed? Is it possible to have 2 pressed at the same time?

zwatts

I was just polling the pins, so it was triggering repeatedly when a button was pressed, but today at lunch I updated it to use the Bounce library and so it will only register the button once when it is pressed.

In regard to "Is it possible to have 2 pressed at the same time?" , do you mean, register two simultaneous presses? No, so if buzzers A and B are pressed simultaneously, A will register as the button pressed unless you do it between polling A and B. So there is a slight benefit to being A over B, but also D over A. I calculate that the buttons are being polled at least every 10ms, so I think that is sufficient resolution, at least for my purposes.

My thought was that it be more fair if there no advantage of one button press over another.I think this could be done somewhat simply by doing 4 reads in row:void loop(){button1_state = digitalRead(button1);button2_state = digitalRead(button2);button3_state = digitalRead(button3);button4_state = digitalRead(button4);to capture all 4 nearly identically in timethen see if where any zeroes in that one read sequenceif (button1_state == low || button2_state == low || button3_state == low || button4_state == low){if there was a low, then figure out which it was and take the appropriate actioncould probably use the bounce() code here alsoif (button1_state == low){do something}if (button2_state == low){do something}if (button3_state == low){do something}if (button4_state == low){do something}then reset the buttonx_states to high again for the next roundbutton1_state = high;button2_state = high;button3_state = high;button4_state = high;and add a bit of delay to debounce if your switches are still bouncig} //otherwise go back to top of void loop again.}thus if there was a tie both button presses could get the credit duebut then you'd have to deal with that on the PC end too. Maybe in the next revision...