6. Chapter Pong Game
We have experienced single-player game snake before. Now, let’s use control board to play classic two-player pong game. You will experience both 2D and 3D version.
6.1. Project 6.1 Pong Game
First, let’s experience the 2D version game.
6.1.1. Component list
Control board x1
|
||
Breadboard x1
|
GPIO Extension Board x1
|
|
USB cable x1
|
Jumper M/M x3
|
|
Rotary potentiometer x2
|
||
6.1.2. Circuit
Use A0, A1 ports on connect board to detect the voltage of rotary potentiometers.
Schematic diagram |
|
Hardware connection If you need any support, please feel free to contact us via: support@freenove.com |
|
6.1.3. Sketch
6.1.3.1. Sketch Pong_Game
Use Processing to open .\Processing\Processing\Pong_Game\Pong_Game.pde ,and click Run.
If the connection succeeds, the follow will be shown:
Now you can try to control the racket motion by pressing the corresponding button. Press space bar to start the game:
Use button to control the movement of paddle to block the ball back. The game rules are the same as classic pong game:
The game will be over when one side reachs three points. Pressing the space bar can restart the game:
Additionally, you can restart the game by pressing the space bar at any time.
6.2. Project 6.2 Pong Game 3D
Now, let’s experience the 3D version game.
6.2.1. Component list
The same as last section.
6.2.2. Circuit
The same as last section.
6.2.3. Sketch
6.2.3.1. Sketch Pong_Game_3D
Use Processing to open .\Processing\Processing\Pong_Game_3D\Pong_Game_3D.pde , and click Run.
If the connection succeeds, the follow will be shown:
Now you can try to control the racket motion by pressing the corresponding button. Press space bar to start the game:
Use button to control the movement of paddle to block the ball back. The game rules are the same as classic pong game:
The rest operation is the same as the 2D version.







