Whack a Mole
A game in which you have to hit moles :)
Author: Chiorean Irina
GitHub Project Link: https://github.com/UPB-PMRust-Students/project-IrinaCh524
Description
My project is a "Whack-a-Mole" game. It features four moles that briefly pop up (for about one second each) in random order. A mole will go down either when the time runs out or if the player successfully hits it, in which case the player scores a point. This continues for 20 seconds, after which the total score is displayed on the screen.
Motivation
In all honesty, I chose this idea for my project because my sister had planned to do it last year but had to abandon it due to time constraints.
Architecture
-
Start and Restart buttons -used to start and restart the game
-
Screen -displays your final score at the end of the game
-
Game Area -4 sets of "moles" that consist of one servo motor and one micro-switch each
-the motors are connected to a source of 5V and 10A
Log
Week 10 - 28 April
As of right now, I have a prototype that has LEDs and buttons instead of the motors and switches. Next, I need to 3D model the game area of my project before replacing the LEDs with the motors and other components.
Week 12 - 18 May
I replaced the leds and coded the game with the servo-motors and switches.
Hardware
This was the prototype for the game in which i had leds that would represent the moles going up and buttuns instead of switches.
This is how the game looks right now without the 3D printed parts of the game.
Raspberry Pi Pico W
-Central microcontroller
-runs the program
Source (5V-10A LRS-50-5 MEAN WELL) -used specifically for the servos
Servo motors (MG996R)x4 -used to push up the moles
Micro-switches x4
Display (LCD 2.4'' SPI ILI9341)
Schematics
Bill of Materials
Device | Usage | Price |
---|---|---|
Raspberry Pi Pico W | The microcontroller | 35 RON |
LCD 2.4'' SPI ILI9341 | Display | 70 RON |
Microswitch 1A 125V | Switch x4 | 12 RON |
Servomotor MG996R | The motor x4 | 112 RON |
LRS-50-5 5V/10A MEAN WELL Source | The source | 74 RON |
Wires + Breadboard + Buttons | For connections and such | 20 lei |
Software
Library | Description | Usage |
---|---|---|
ili9341 | Display driver for ILI9341 | Used for the display for showing the score |
embedded-graphics | 2D graphics library | Used for drawing to the display |
heapless | Data structures that don't require dynamic memory allocation | Used for transforming the score variable from to u32 to String |
picorand | Library intended for random number generation | Used for generating the mole order |
Links
This is where the idea came from initially: Mini Whack A Mole Game