Introduction: LED Whack-a-mole

This game of "Whack-a-mole" utilizes seven LEDs and a joystick. There are 4 "moles" on my board, represented from the left by the 3rd, 4th, 5th, and 6th LEDs. One of these four LEDs will light up randomly and will offer a fixed amount of time to hit the corresponding direction on the joystick. I set the LEDs in a way so that the choices on the joystick are from left to right: left, down, up, and right.


1. Arduino UNO

2. 7 LEDs (3 green, 2 red, and 1 yellow

3. 7 resistors 330 ohm

4. 1 ps2 joystick

5. Wires

6. A small shoebox

Step 1: Gather All the Materials

You do not need any fancy tools to make this project. Instead of the 330-ohm resistors, you can also use 220-ohm resistors. If you color code the LEDs and the wires then that makes it easier to play on harder levels.

Step 2: Follow the Schematic

Everything should match the real picture of the project except for the joystick. My joystick has 5 pins, 4 of which I have used: named from top to bottom "Y", "X", "Bt", and "VCC", and "GND" is connected to GND and 5V on the Arduino, "X" and "Y" are connected to A0 and A1. You can also use the 5th pin of the joystick but you will have to add one more LED (one more mole) and also add the code for that.

Step 3: How to Play the Game

The two lights on the left are red and green, which indicate an incorrect or correct choice. The yellow light to the far right blinks the count for the current high score, and it indicates the score every time a run is over (whenever a wrong choice is made). In order to score a point, you will have to hit the corresponding direction on the joystick when an LED randomly lights up in a fixed amount of time.

Step 4: Difficulty Levels

The difficulty levels that I have written into my code as constants are the time in milliseconds that the person has to make a selection. You can mess around with these times to change the difficulty for your own preference.

Step 5: