ESP32-S3 RGB LED Matrix Project 6 - Cible game

ESP32-S3 RGB LED Matrix Project 6 - Cible game

Project 6 – Target Game (Tilt the Board to Hit the Circle)

Project 6 is the final and most interactive project in this ESP32-S3 RGB LED Matrix series. Using the onboard QMI8658C motion sensor, you tilt the board to move a dot around the 8×8 matrix. A circular “target zone” sits in the middle of the display. When your dot touches the circle, the color changes and (optionally) a buzzer beeps. This creates a simple but surprisingly fun balance/coordination game.

All six projects are demonstrated in a single YouTube video (embedded on this page). The complete game code is loaded automatically below this article, and affiliate purchase links for the module appear under the code section.

ESP32-S3 RGB LED Matrix Module Overview

This module includes:

  • ESP32-S3 microcontroller (Wi-Fi + BLE)
  • 8×8 RGB LED matrix (64 addressable LEDs)
  • QMI8658C accelerometer for tilt and orientation sensing
  • USB-C port for power and programming
  • Boot / Reset buttons
  • Available GPIO pins for add-ons like buzzers or sensors

For this game, the accelerometer is essential—it continuously reports X/Y tilt, allowing the dot to move smoothly based on board angle. The video section for this project clearly shows how the dot glides and reacts as you tilt the module left/right/forward/back.:contentReference[oaicite:0]{index=0}

Projects Covered in the Video (Timestamps)

  • 00:00 – Introduction
  • 02:01 – Installing ESP32 boards
  • 03:32 – Installing libraries
  • 05:32 – Project 1: Moving Dot
  • 11:11 – Project 2: Text Scroll
  • 12:59 – Project 3: HTTP Text
  • 16:41 – Project 4: Tilt Dot
  • 18:55 – Project 5: Arrow Up
  • 20:02Project 6: Target Game (this project)

This portion of the video shows both the dot movement and the circle detection logic in action, making it easier to understand how the coordinates behave.:contentReference[oaicite:1]{index=1}

Installing ESP32 Boards in Arduino IDE

If you have already completed the earlier projects, board installation is done. Otherwise follow:

  1. File > Preferences → Add ESP32 board URL.
  2. Tools > Board > Boards Manager… → Install “ESP32”.
  3. Select the ESP32-S3 board under Tools > Board.
  4. Select the correct COM port under Tools > Port.

Installing Required Libraries

This game uses:

  • Adafruit NeoMatrix
  • Adafruit NeoPixel
  • Adafruit GFX
  • QMI8658 (motion sensor)

Install them via:

  1. Sketch > Include Library > Manage Libraries…
  2. Search: NeoMatrix → Install
  3. Install dependencies (GFX + NeoPixel)
  4. Search and install QMI8658

How the Target Game Works

The QMI8658C accelerometer provides X and Y tilt values. These are mapped to LED coordinates (0–7 in both directions). Your dot moves across the matrix based on the board’s angle.

A circle (or ring) is drawn on the display as the “target area.” You win a “hit” whenever the dot overlaps the circle. At that moment:

  • The target color changes (random or predefined)
  • An optional buzzer beeps (if connected)

Since the matrix is small, the circle is drawn using a simple radius check. The game runs continuously, so you can tilt back and forth to hit the circle repeatedly.

Project 6 – Code Settings (Target Game)

Below are the main user-adjustable settings located at the top of the sketch. The full code is automatically included below this article.

Matrix Configuration


// Matrix configuration
const int MATRIX_PIN    = 14;
const int MATRIX_WIDTH  = 8;
const int MATRIX_HEIGHT = 8;

The RGB matrix is hard-wired to GPIO 14—do not change this.

Brightness


uint8_t matrixBrightness = 40;   // 0–255

For indoor use, 30–60 is ideal.

Dot Color


// Dot color (R, G, B)
uint8_t dotRed   = 255;
uint8_t dotGreen = 255;
uint8_t dotBlue  = 255;

This is the dot you move by tilting the board.

Circle Color (Random or Fixed)


// Circle (target) color
uint8_t circleRed   = 0;
uint8_t circleGreen = 0;
uint8_t circleBlue  = 255;

// If true, choose a new random color each time the dot hits
bool randomCircleColor = true;

Set randomCircleColor = false; if you want a fixed color.

Circle Radius


// Target size (radius)
int targetRadius = 3;   // 3 fits well on 8×8 matrix

Larger radii make the game easier; smaller ones make it harder.

Tilt Sensitivity


// Sensitivity of tilt mapping
float tiltScale = 4.0f;   // increase = faster movement across screen

If the dot moves too fast or jumps, reduce this number.

Buzzer Settings (Optional)


// Buzzer pin (optional)
int buzzerPin = 6;      // connect buzzer + to pin 6, – to GND
bool useBuzzer = true;  // set false to disable sound

If you don’t connect a buzzer, simply set useBuzzer = false;

Summary

Project 6 combines everything learned from earlier projects: matrix drawing, accelerometer input, color control, movement smoothing, and optional sound. Tilting the board moves the dot, and hitting the circle changes its color and (optionally) triggers a beep. It’s a fun demonstration of motion-sensing on a compact RGB display.

The full “Target Game” code is displayed automatically below this article. You can also watch the Project 6 portion of the video to see how the dot moves and how hits are detected. If you’d like to build your own game, affiliate links for buying the ESP32-S3 RGB LED Matrix module appear under the code section.

Imágenes

ESP32 S3 Matrix
ESP32 S3 Matrix
ESP32 S3 Matrix  pin out
ESP32 S3 Matrix pin out
ESP32-S3_RGB_8x8_matrix-3
ESP32-S3_RGB_8x8_matrix-3
ESP32 S3 Matrix displaying rainbow heart 3
ESP32 S3 Matrix displaying rainbow heart 3
ESP32-S3_RGB_8x8_matrix1
ESP32-S3_RGB_8x8_matrix1
ESP32-S3_RGB_8x8_matrix-2
ESP32-S3_RGB_8x8_matrix-2
804-ESP32-S3 RGB LED Matrix Project 6 - Cible game
Idioma: C++
¡Copiado!

Cosas que podrías necesitar

Recursos y referencias

Aún no hay recursos.

Archivos📁

No hay archivos disponibles.