🎮 Project 4 – Space Invader on MAX7219

📸 Photos

🔧 Project Goal

Build a simple Space Invader arcade-style game using:

  • A MAX7219 8×8 LED matrix to display the game,
  • A joystick to control the spaceship,
  • A 1602 LCD display (non-I2C) to show the welcome screen and the current score.

This project combines electronics, interactive game logic, and display control — all in one fun package 🚀


📦 Hardware Used

  • 1× Arduino UNO
  • 1× MAX7219 LED matrix (8×8)
  • 1× Analog joystick
  • 1× LCD1602 display (no I2C)
  • 1x 220 resistors
  • Jumper wires, breadboard, potentiometer (for LCD contrast)

🔌 Wiring Overview

MAX7219

  • DIN → Pin 11
  • CLK → Pin 13
  • CS/LOAD → Pin 10

LCD1602

  • RS → D8, E → D7, D43-D7 → D9 to D12
  • Potentiometer between V0 and GND to adjust contrast

Joystick

  • VRx (horizontal) → A3
  • Vcc / GND → 5V / GND

🧠 How It Works

  1. Startup Screen:
    The LCD displays: pgsqlCopierModifierSpace Invader Move to play! The MAX7219 shows a big « S » as the game logo.
  2. Start Game:
    The game starts when you move the joystick left or right (X axis).
  3. Gameplay:
    • You control a spaceship at the bottom of the LED matrix.
    • Shooting is automatic (one bullet at a time).
    • Three aliens fall from the top of the screen.
    • Every alien hit gives you +1 point (shown on the LCD).
    • If an alien hits your position → Game Over.
  4. Game Over Animation:
    A quick animation is shown, and the game restarts automatically.

✨ Results

  • ✅ Fully playable and responsive
  • ✅ Smooth joystick controls
  • ✅ Clean, real-time score display on non-I2C LCD1602
  • ✅ Easy replay loop, perfect for learning or fun

💡 What I Learned

  • How to coordinate two display systems (LED matrix + LCD)
  • Handling analog joystick inputs for directional control
  • Using millis() to handle timed movement (non-blocking delay)
  • Basic game design logic using arrays and flags
  • Writing clean Arduino code with modular functions

🧪 Possible Improvements

  • Add a button to manually shoot bullets
  • Use a buzzer for sound effects (shoot, hit, game over)
  • Implement a difficulty setting (alien speed increases over time)
  • Make the matrix smoother by optimizing loop() with only millis() (no delay())

📁 Source Code

🔗 Check out the full project and code on GitHub:
👉 My Github Link

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *