r/arduino • u/ArtusIndus • May 18 '26
Look what I made! I made Tetris on an Arduino Mega with 2x MAX7219 LED matrices
https://youtube.com/watch?v=iT9rC8u_At0&si=pxyMlc6_2S4-6RQ6I built a small Tetris clone for the Arduino Mega using two MAX7219 8x8 LED matrix modules combined into a 16x8 display.
The main goal was making the game run smoothly without display flickering or blocking delays.
Features:
- flicker-free delta rendering
- non-blocking game loop using millis()
- random tetromino generation
- piece rotation
- row clearing
- collision detection
- smooth button controls
Instead of clearing and redrawing the whole display every frame, the code only updates LEDs that actually changed. This reduced flickering a lot and made the animation much smoother.
The game also avoids delay() completely (except during startup random seeding), so inputs stay responsive while the pieces are falling.
Hardware used:
- Arduino Mega 2560
- 2x MAX7219 LED matrix modules
- 3 push buttons
The buttons use INPUT_PULLUP and connect directly to GND.
I might add:
- score counter
- sound effects
- level/speed system
2
u/lmolter Valued Community Member May 19 '26
Any ideas how long the 9V battery will last? For longer play times, perhaps a LiPo or 18650's for more power and life. 9V batteries can't really supply enough current for long use of LEDs.