Home » Arduino » Whac-A-Button With Arduino

Whac-A-Button With Arduino

Whac-A-Mole like game with Arduino and Arcade style LED buttons.

This is a very simple version of the Whac-a-mole game, where a button lights up and waits for the player to hit it. If the correct button is hit the score is updated and a new button lights up. The player is not punished if they hit the wrong button. Only one button lights up at a time. Time to hit the button reduces each game cycle.

arduino-whac-a-button

Kit includes:
5 LED buttons
All required wires, screws and nuts
Arduino nano
Laser cut acrylic panels
4 digit 7 Segment display TM1637
USB cable

 

Assembly

Start by adding the display and buttons. Make sure the display pins are pointing inwards, the colour arrangement of the buttons is up to you.

arduino-whac-a-button-assembly

Use 2 screws to secure the display in place.

Keep all buttons in the same orientation – it will make wiring easier.

Wiring might look messy but it’s very simple.

Connect all grounds together using the daisy chain 2.8mm crimp connectors. Again if all buttons are in the same orientation it will be much easier. The end with a jumper wire connect to the Arduino GND.

arduino whac-a-mole-wiring

Now connect the rest of the pins as shown in the images below:

Connect the display.

Display –  Arduino

CLK    –   Pin 8

DIO     –   Pin 7

GND    –  GND

5V        –  5V

Arduino TM1637 display

Use jumper wires to connect all LEDs to the Arduino pins.

LED1 – Pin9

LED2 – Pin10

LED3 – Pin11

LED4 – Pin12

LED5 – Pin13

Now use jumper wires to connect all buttons to the Arduino pins. Make sure that if you’ve used for example the green button for LED1 you’ll have to use it as Button1 as well.

Button1 – Pin2

Button2 – Pin3

Button3 – Pin4

Button4 – Pin5

Button5 – Pin6

Tape the wires together to keep them from disconnecting.

Once everything is connected test if it works before assembling the panels.

Code

Download the code from GitHub – Whack-a-button and upload it to the Arduino.

At start the game will be in waiting for input where all LEDs will be flashing until one of the buttons is pressed and that’s when the game will start. After the game ends it will return to the waiting for input state while still showing the latest score and it will stay like that until a button is pressed and new game starts.

After you’ve checked that everything is connected correctly assemble the rest of the panels.

Leave the right panel last as that’s where the usb cable will be coming out.

 

Enjoy your play.

 

Buy Arduino Whac-A-Button Kitarduino-whac-a-button

0 Flares Twitter 0 Facebook 0 Filament.io 0 Flares ×

6 Comments

  1. Very nice and funny game with simple components.
    Just a comment about “LED5 – Pin12”, should it be Pin13?

  2. why does the LED have to be powered externally? Doesn’t it get powered by being an output of the arduino from the pin?

  3. I am new to arduino, but this looks really neat!
    What Arduino board (how many pins) do I need to expand this to more (10-20) buttons?
    Thanks!!

Leave a comment

Your email address will not be published. Required fields are marked *

0 Flares Twitter 0 Facebook 0 Filament.io 0 Flares ×