
I made Tetris on an Arduino Mega with 2x MAX7219 LED matrices
I 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