Skip to main content
Version: FILS English

Whack a Mole

A game in which you have to hit moles :)

info

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

  1. Start and Restart buttons -used to start and restart the game

  2. Screen -displays your final score at the end of the game

  3. 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

Schematic

Schematic

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.

Hardware

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

Schematic

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico WThe microcontroller35 RON
LCD 2.4'' SPI ILI9341Display70 RON
Microswitch 1A 125VSwitch x412 RON
Servomotor MG996RThe motor x4112 RON
LRS-50-5 5V/10A MEAN WELL SourceThe source74 RON
Wires + Breadboard + ButtonsFor connections and such20 lei

Software

LibraryDescriptionUsage
ili9341Display driver for ILI9341Used for the display for showing the score
embedded-graphics2D graphics libraryUsed for drawing to the display
heaplessData structures that don't require dynamic memory allocationUsed for transforming the score variable from to u32 to String
picorandLibrary intended for random number generationUsed for generating the mole order

This is where the idea came from initially: Mini Whack A Mole Game