GamesA Two-Player Reaction Game
An LED lights at a random moment. Whoever presses their button first wins. Built from Student Kit parts in 45 minutes.
GamesFive buttons, five notes: C, D, E, F and G. Press a button and the buzzer plays its note, enough for simple tunes.
Adapted from “Simple keyboard using the tone() function” by Arduino. Licence: CC BY-SA 4.0. This translation is shared under the same licence. The parts list and the tips are RoboHub's.
Choose a variation and the parts list updates.
Place five buttons in a row on the breadboard. Connect one leg of each button to the ground rail and the other to pins 2, 3, 4, 5 and 6. On a four-leg button use two diagonally opposite legs: the two legs on one side are always connected inside.
Connect the passive buzzer's “+” to pin 8 and “−” to ground. An active buzzer (one with its own oscillator) plays only one tone, so you need a passive buzzer or a piezo element here.
tone() makes the buzzer sound at a given frequency: 262 Hz is C, 392 Hz is G. noTone() stops the sound when you let go of the button.
const int BUZZER = 8;
const int KEYS[] = {2, 3, 4, 5, 6}; // one button per note
const int NOTES[] = {262, 294, 330, 349, 392}; // C D E F G (Hz)
const int COUNT = 5;
int playing = -1; // the note that sounds now, -1 = none
void setup() {
for (int i = 0; i < COUNT; i++) pinMode(KEYS[i], INPUT_PULLUP); // pressed = LOW
}
void loop() {
int pressed = -1;
for (int i = 0; i < COUNT; i++) {
if (digitalRead(KEYS[i]) == LOW) { pressed = i; break; }
}
if (pressed != playing) { // change the sound only when the key changes
if (pressed < 0) noTone(BUZZER);
else tone(BUZZER, NOTES[pressed]);
playing = pressed;
}
delay(5);
}Try E, D, C, D, E, E, E. For other notes change the frequencies in the NOTES array: F sharp is 370 Hz, A is 440 Hz.

Illustration, made with AI
Illustration: beside a ukulele, five buttons in a row like piano keys and a buzzer; a child presses one.
Step 4: Play
GamesAn LED lights at a random moment. Whoever presses their button first wins. Built from Student Kit parts in 45 minutes.
Lights and displaysCars have green until a pedestrian presses the button. Then the cars get red, the pedestrians get green and a buzzer ticks, just like at a real crossing.
Home and IoTA PIR sensor notices a warm body moving. As soon as someone walks into the room, a siren sounds and a red light flashes.