yuukidach / STM32-VGA-snake

Using STM32 to create the game of snake and display it on screen through VGA.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

STM32 VGA Snake Game

Video

Bilibili
Youtube

Descriptions

Creating a snake game with STM32, and showing it on the screen through VGA. It's quite a simple project that we can finish it in no time. It's also easy to test. All we need are just a screen, some DuPont lines and focus.

VGA settings: 800 x 600 @ 56Hz
(Real pixel value: 400 x 200)

Material

STM32F103C8
VGA line
Potentiometer
PS2 controller

Pin Connections

Pin Function
PA1 Vsync
PA7 Green
PA8 Hsync
PB4 DATA
PB5 CMD
PB6 CS
PB7 CLK

Part of The Code Explaintion

The part of VGA is copied from here. You can click the link and see more details.

snake.c is the main part of the project. It contains the game's core code. Since it is easy to understand and write, I did not add to much notations in it. The body of the snake is stored by a list. By the way, the snake's head and tail are opposite to the head and tail of the list. Try not to be confused.

adcrand.c uses adc to generate random number. It's more stochastic than using timer.

About

Using STM32 to create the game of snake and display it on screen through VGA.


Languages

Language:C 55.1%Language:HTML 28.9%Language:Makefile 11.4%Language:Assembly 4.6%Language:C++ 0.1%