Last updated: 20/08-2020
Introduction:
I made Pong for the STM32F7-DISCO EC
Features:
Pong is a 2 player PvP game, in which you each have a bar, which you can use to keep a ball from going behind you.
If the ball does get behind you the opposing player gets a point. When you decide to stop playing, the player with the most points win.
When you start the game you also have the choice to increase the speed and FPS. The FPS changes how fast the ball moves and the speed changes how many pixels the ball moves each frame.
The speed will also exponentially increase automatically if no player has scored for some time.
There is also an option to turn on or off sound.
Each player is controlled with a potentiometer for full analog controls.
There is also 3 usable buttons, 2 of which is integrated on the board.
The black button takes you back to the menu.
The blue button pauses/unpauses the game. And the third button connected with a cable resets the score and ball position, it also clears any artifacts if the game has glithed. (Should not happen in the current version)
How I made it:
I made it by drawing a picture on the screen many times a second, which makes it look like the objects move.
The players move to the absoloute position of each potentiometer respectively, meaning that the player will always move to the same position when the potentiometer is turned to the same position.
Problems/Changes:
Originally I cleared the entire screen each frame, but the display could not update that fast, so instead I just cleared the pixels that need be cleared.
Libraries used:
mbed.h - mbed 0S 6.2.0 library
rect.h - header for custom class
stm32746g_discovery_lcd.h - library for the visual part of the display
stm32746g_discovery_ts.h - library for the touch part of the display
Pin Connections:
Devices have to be connected to the following pins
Button: D4
Potentiometer 1: A0
Potentiometer 2: A1
Buzzer: D8
Made by Troels Wittrup-Jensen