RetroRacing Video Game
Embedded Programming Project
Requirements
Write and test a program on a micrcontroller that runs a retro-style racing game on 128x64 OLED display.
Use touchpads as player controls to move the car left and right.
Display car, road, and obstacles on OLED.
Flash blue LED as a status indicator.
Design
Below is a hand-drawn schematic of the gamepad. The region highlighted is the OLED on which the game will be displayed.

I designed 7 different screens that make up the game flow, from the start screen through to the game over screen:
- Start Screen - states the name of the game and waits for the player to press start.
- Main Menu - allows player to navigate through different game options to adjust levels of game difficulty.
- Loading Screen - resets variables and loads track options in the background.
- Countdown Screen - alerts the player that they can soon begin racing.
- Gameplay Screen - displays car on the track with barriers scrolling downward while also showing 5 minute countdown and top 5 times.
- Game Over 1 - triggered when the car hits a barrier and shows a "Red Flag" ending.
- Game Over 2 - triggered if the 5-minute timer runs out without crashing.







Here is the layout of the gamepad with the touchpad regions bolded.

To the left is the directional pad, which allows the user to input the directions up, down, left, and right.
The left and right buttons will be used to navigate the car on track.
To the right of the gamepad are the start and back buttons.
Hardware
I had 2 different types of microcontrollers at my disposal:
Here
is a detailed comparison between the two microcontrollers.
For the purpose of this project,
ATSAMD21E18 | RP2040 | |
---|---|---|
I ended up going with the ATSAMD21E18 microcontroller.
Below is an annotated screenshot of PCB schematic created in KiCAD for the gamepad.
I've also attached the file here
Code Implementation
Coming Soon... [insert side eye]
Testing
Final Product
DownloadStill figuring out how to format images and videos.Sowwy.
