Epic Tetris on the Seeeduino Wio Terminal: a 27-Column Challenge With Custom Controls
by daisykorr in Circuits > Arduino
69 Views, 1 Favorites, 0 Comments
Epic Tetris on the Seeeduino Wio Terminal: a 27-Column Challenge With Custom Controls

In this project, we transform the Seeeduino Wio Terminal into a fully functional Tetris console. This version of Tetris is different from the classic game – it features an expanded board with 27 columns and 17 rows, where each cell measures 12×12 pixels. A dedicated score display is set in the top area of the screen (30 pixels high), and the game offers custom controls for an enhanced playing experience.
Custom Key Controls:
- WIO_KEY_A (Pin 6):
- Short Press: Moves the falling tetromino left.
- Long Press (>500ms): Instantly drops the tetromino to the lowest available position.
- WIO_KEY_B (Pin 5):
- Short Press: Moves the falling tetromino right.
- Long Press (>500ms): Restarts the game (this applies both during normal play and when the game is over).
- WIO_KEY_C (Pin 9):
- Short Press: Rotates the tetromino 90° clockwise.
The code is designed to reduce screen flicker by updating the score area only when needed and using optimized drawing routines. Let’s dive in!
Supplies

- Seeeduino Wio Terminal
- USB Cable for programming the Wio Terminal
- Arduino IDE (or another compatible development environment)
- TFT_eSPI Library installed via the Arduino Library Manager
Product Introduction



Start by familiarizing yourself with the Wio Terminal.
- What is the Seeeduino Wio Terminal?
The Seeeduino Wio Terminal is an all-in-one microcontroller board equipped with a color LCD and numerous IO options. It’s perfect for portable projects and interactive applications.
- Features for this project:
- Built-in TFT display
- Multiple digital IO pins for button inputs
- Compact design ideal for retro gaming projects
Connecting the Wio Terminal to Your Computer
(1).png)
- Power Up & Connect:
Use the USB cable to connect the Wio Terminal to your computer.
- Device Recognition:
Ensure your computer recognizes the device. Check in the Device Manager (on Windows) or System Information (on macOS/Linux).
- Select Your Board in the Arduino IDE:
- Open the Arduino IDE.
- Navigate to Tools > Board and select the correct Wio Terminal board.
- Choose the appropriate port under Tools > Port.
Preparing the Code

- Install the TFT_eSPI Library:
In the Arduino IDE, go to Sketch > Include Library > Manage Libraries…, search for TFT_eSPI, and install it.
- Configure the TFT_eSPI Library:
Check the User_Setup.h file in the TFT_eSPI library folder to ensure the settings match the Wio Terminal specifications.
- Copy/ Write the Code:
Download and copy the complete code provided below into a new Arduino sketch. Or if you want to customize other features, just edit the code.
Downloads
Uploading and Testing the Code

- Compile and Upload:
Click the Upload button in the Arduino IDE to compile and upload the sketch to your Wio Terminal.
- Run the Game:
Once uploaded, the Tetris game will launch automatically. Watch as a random tetromino (from seven classic Tetris pieces) starts falling onto a 27-column board.
- Use the Controls:
- Press Key A (Pin 6) to move left or hold it to drop the piece instantly.
- Press Key B (Pin 5) to move right or hold it to restart the game.
- Press Key C (Pin 9) to rotate the piece clockwise.
- Enjoy the Game:
Clear full lines to score points. Each cleared line adds 1 point, and your score is displayed in the top score area.
Application Examples and Expansion Ideas
Once the game is running, try the following enhancements:
- Sound Effects: Use the Wio Terminal's built-in buzzer to play sounds when rows are cleared or the game ends.
- High Score Tracking: Save the high score to the Wio Terminal's flash memory and display it.
- Speed Levels: Increase the dropInterval as the score rises to make the game more challenging.
- Custom Shapes: Modify the tetrominoes array to create new block designs.
References
TFT_eSPI Library on GitHub – Official repository and documentation.
Wio Terminal Resources:
Tetris Fundamentals:
- Tetris Wikipedia
- Various online tutorials on game development and collision detection.