Chapter 6 Tetris

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

Project 6.1 Tetris

Now, let’s use Processing and ESP32 board to achieve the tetris game.

Component list

ESP32-WROVER x1

Chapter01_00

GPIO Extension Board x1

Chapter01_01

Breadboard x1

Chapter01_02

Jumper M/M x4

Chapter01_05

Resistor 10kΩ x4

Chapter02_01

Push button x4

Chapter02_02

Circuit

Use Pin4, Pin5, Pin18, Pin19 port on ESP32 board to control the movement of the block.

Schematic diagram

Chapter06_00

Hardware connection

Chapter06_01

Sketch

Sketch Tetris

Use Processing to open Tetris.pde and click Run. If the connection succeeds, the follow will be shown:

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

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

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

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

../../../_images/Chapter06_041.png