David R. Carroll's M5Stack M5StickC Plus Tetris Uses a Clever Single-Button Input Scheme

With a little tweak to where blocks appear, this working Tetris port gets away with just a single button for its control system.

Gareth Halfacree
2 months agoGames / Retro Tech

Developer David R. Carroll has written a version of popular block-dropping game Tetris that runs on an M5Stack M5StickC Plus and uses only a single button for control.

"I spent an enjoyable month writing this," Carroll writes of the project, which was written in the Arduino IDE. Based on the original Tetris by Alexey Pajitnov, recently the subject of a biographical thriller by Jon S. Baird, Carroll's port includes everything you'd expect: the four-block tetrominos which fall inexorably and ever-speedier from the ceiling to fill a tall playfield, disappearing only if you can make an unbroken line from side-to-side — with the highest points only available to those delivering a "Tetris" and making four rows disappear at the same time.

This port of Tetris isn't just tiny, but comes with an interesting control scheme based around a single push-button input. (📹: David R. Carroll)

Unlike Pajitnov's original and the bulk of its subsequent ports, clones, updates, and homages, though, Carroll's version has a difference — and it's not just that it's running on an M5Stack M5StickC Plus, an all-in-one development board based on the Espressif ESP32-PICO module: Carroll's version uses only the microcontroller's single large front-facing push-button as its input.

The trick: Carroll's game reads three different inputs from that one button depending on how it's pressed: a quick click moves the block to the right; double-clicking rotates the block; and holding the button causes the block to rapidly fall to the bottom of the play surface. Astute readers may notice there's no input for moving the block to the left: all blocks start at the left-most side of the playfield, in a change to the original, and can only move right.

More information on the project is available in Carroll's Reddit post, while the source code has been published to GitHub under the permissive Creative Commons Zero public domain license.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles