6. Chapter Tetris

In this chapter, we prepare a tetris game for you. You can play the game by pressing the buttons.

6.1. Project Tetris

Now, let’s use Processing and Raspberry Pi Pico to achieve the tetris game.

6.1.1. Component List

Raspberry Pi Pico x1

Chapter01_08

USB Cable x1

Chapter01_09

Breadboard x1

Chapter01_10

Push button x4

Chapter02_11

Resistor 10kΩ x4

Chapter02_01

Jumper

Chapter01_13

6.1.2. Circuit

Schematic diagram

Chapter06_00

Hardware connection.

If you need any support, please contact us via: support@freenove.com

Chapter06_01

Note

To help users have a better experience when doing the projects, we have made some modifications to Pico’s simulation diagram. Please note that there are certain differences between the simulation diagram and the actual board to avoid misunderstanding.

6.1.3. Sketch

6.1.3.1. Sketch Tetris

Use Processing to open Tetris.pde and click Run. If the connection succeeds, it will show as follows:

../../../_images/Chapter06_011.png

Now you can try using the buttons to control the falling block. Press the space bar to pause the game.

../../../_images/Chapter06_021.png

When the game is over, you can press the space bar to restart the game. Press ESC to exit the game.

../../../_images/Chapter06_031.png