For the mbed mini project, I developed a simple Whack-a-Mole game that uses an ARM microcontroller, six external LEDs, six pushbuttons, and a text LCD. This game was inspired by the popluar arcade game, Whack-a-Mole, where players have to quickly hit moles that would pop up in a random order. For this game, players have to quickly press the buttons matched to certain LEDs that will light up in a random order at different speeds. The number of hits will tally up and the final score will be displayed once the game is over. Each game lasts 30 seconds.
- NXP LPC1768 Microcontroller
- 16x2 HD44780 Text LCD
- 6 External LEDs
- 6 Pushbuttons
16x2 HD44780 Text LCD
Pins 15 and 16 are needed for the backlight on the LCD and were not used in this project. Pins 7 - 10 are not connected too.
|p3 (VO)||GND, via 1k resistor|
The external LEDs are wired to pins 5 - 8, 10, and 11 on the mbed. 100 Ohm pullup resistors are connected in series to each LED.
The pushbuttons are wired to pins 21 - 26 on the mbed.
A simple Whack-a-Mole game using LEDs and pushbuttons
- Add a start menu which would allow the player to select different difficulty levels.
- Add a speaker to play music during the game and to play certain sounds when the "mole" is "hit".
- Increase the amount of LEDs
- Implement a proper randomized system. The rand() function will randomly select an array of values only once. Every time the game is reset, the rand() function just picks the same string of numbers. I would like to implement a random method that actually selects a different set of values on each reset.
Please log in to post comments.