STM32 Dino Game is a minimalist and fully functional recreation of the Chrome dinosaur game, implemented entirely in C for STM32F411 microcontroller. The main idea of this project was to write this code without even standard libraries. So, only stm32f411xe was used(this library conatins only predefined structures of registers in the stm32f411).
- OLED SSD1306 screen
- Blackpill v 2.0 board
- Wires
On the blackpill v2.0 board we have the button that is connected to the PA0, so we will use this button with pull up resistors enabled on microcontroller. As I2C interface for the display we will use PB6 as SCL and PB7 as SDA.
All project is done by modules. I2c.h is used for transmitting data and commands to display by i2c bus. SSD1306.h has all the functions for showing bitmaps and pixels on display. Button.h contains function that is returning button state. Systick.h is used for the delay by microcontroller clock. Bitmaps.h have all the bitmaps that are used in this project
- Download the code from this repository and open it in stm32CubeIDE
- Check all wiring!
- If you are using platfromio and as the board blackpill v 2.0 put in platformio.ini file this:
[env:blackpill_f411ce]
platform = ststm32
board = blackpill_f411ce
framework = stm32cube
upload_protocol = dfu
- Run the code on your microcontroller :)
After burning the board with code please reset it. Than there will be an intro for 1.2 seconds, and after you can play the dino game :) After death you should wait for 1.5 seconds and then you can respawn by clicking user button(button that is used for jumping).