Gianella Bejar.
Software EngineeringCompletedDraft copy · confirm everything

Whack-a-Mole on a microcontroller

A physical reaction game with a keypad, OLED display and saved high scores, built on an STM32 board for an embedded systems course.

My role
Embedded systems course project (your exact contribution to confirm)
Timeline
[Month Year] – [Month Year]
Stack
Embedded CSTM32I2CHALFlash memory
Links
No public links yet

Overview

A hardware version of Whack-a-Mole running on a NUCLEO-F446ZE board (STM32F446, Arm Cortex-M4). Moles appear on an OLED screen and the player hits them using a 4x3 matrix keypad. Scores are kept between power cycles.

The problem

Embedded programming means working directly with timing, memory and peripherals. This project was a way to practise all of them in one small, testable system.

Context and motivation

ECE342, embedded systems. A game gives instant feedback when something is wrong, which makes it a good teacher.

My role

To write.

Approach

The code is split by responsibility: game logic, user interface, flash storage and fonts, each in its own module.

Technical architecture

A keypad is scanned for input, an SSD1306 OLED is driven over I2C, and a high score is written to flash memory (sector 7). Timing uses the HAL millisecond tick, and the game loop is non-blocking so input never stalls the display.

Implementation

Two details worth showing: flash must be erased before it is written, and the stored score is guarded by a magic-number check so a blank or corrupted sector is not mistaken for a real score.

Trade-offs and decisions

OptionTrade-offChosen
Non-blocking timing with SysTickSlightly more state to manageYes
Blocking delaysSimpler, but freezes input and displayNo

Results and impact

A working game with persistent high scores. Add anything measurable you can stand behind.

Lessons learned

Regenerating code from the board configuration tool overwrote custom code that sat outside the protected USER CODE blocks. Keep your code inside them.

What's next

To write.

Repository link, if public.