ESP32 Projects
Start a build
Markdown

ESP32 Snake

An ESP32 display project involving LED matrix.

ESP32PlatformIOUnrated
Parts and source

Before you start

Check the exact LED matrix configuration against the upstream wiring or parts list.

Upstream README

Contributors Forks Stargazers Issues


Logo

A Snake game for ESP32 and HUB75 Led Matrix!

About The Project

esp32-snake

This project is a Tetris game designed to run on an Ulanzi Desktop Clock paired with a Wiimote controller for game commands.

It's inspired by the work of Aaron Liddiment and Scott Marley.

esp32-snake]

Built With

This project is built this frameworks/libraries:

  • PlatformIO
  • ESP32
  • MelodyPlayer
  • ESP32Wiimote
  • FastLed
  • NeoMatrix
  • AutoConnect

Usage

Single Player Mode

The simplest way to use Esp32 Snake is to run it in single player mode.

See Build And Install for installation procedure.

Once esp32-snake device is turned on :

  1. Press the "1" and "2" buttons on the Wiimote
  2. The LED1 will be on when they have finished connecting

You can now start a new game by pressing "1" or "2" button.

Hold the Wiimote horizontally and use "<", ">" and "v" keys to move Tertrominoes and "1" or "2" buttons to rotate Tetrominoes.

Settings
Brightness

Adjust leds brightness by holding "A" button and pressing "+" or "-".

Buzzer volume

Adjust the volume of the buzzer by holding "B" (trigger) button and pressing "+" or "-".

Background effect

Change the effect displayed on the board's background by pressing "+" or "-" buttons.

Available backgrounds are :

  1. None
  2. Plain
  3. Swim lanes
  4. Chessboard
  5. Stripes
  6. Waves
  7. Plasma
Two Player Mode

For Two Player mode you will need 2 Ulanzi Desktop Clocks and 2 Wiimotes. While the Wiimote is connected to esp32-snake module via Bluetooth, the communication between the two esp32-snake modules will run through the Wifi network. For that you will need to setup Wifi for each esp32-snake device with Autoconnect :

  1. Turn on your Awitris device
  2. Connect your Wiimote (needed for the Wifi stack to work properly in shared mode with Bluetooth)
  3. Use your phone or laptop to connect to the "esp32-snake" Wifi Access Point
  4. Enter your Wifi password in the captive portal using the AutoConnect menu.
  5. Wait for a few seconds for the password to be saved in the NVS memory (if password has not been saved upon restart, run the procedure one more time)
Overview   Captiveportal

Once both esp32-snake devices are on and connected to the same Wifi network, press "Home" button on one of the remotes.

This will prompt for a 2 player game on the second device.

Just press "1" or "2" button on the second device to start the 2 player game.

In 2 player mode, each time a player manages 2, 3 or 4 lines at a time, the second player will receive 1, 2 or 4 lines at the bottom of his board.

The game ends whenever one of the players fills his screen.

Build And Install

Build

To build the project, you just have to run Build command in PlatformIO.

Build
Installation

Installation is performed with Upload or Upload and Monitor commands in PlatformIO while the esp32-snake device is connected via USB.

Upload and Monitor

Roadmap

  • [x] Tetris game port to esp32-snake device using FastLed NeoMatrix
  • [x] Connection to Wiimote as a gamepad
  • [x] Tetris Music and sound effects using MelodyPlayer library (modified version to support tempo change an volume change)
  • [x] Change buzzer volume and LED brightness using Wiimote
  • [x] Change background effect using Wiimote
  • [x] Save settings (volume, brightness, background effect, high score) to NVS memory
  • [x] Connect the device to Wifi with AutoConnect
  • [x] 2 Player mode
  • [ ] Documentation
    • [x] English Readme
    • [ ] French Readme
    • [ ] French Tutorial to create a Tetris game

See the open issues for a full list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Fredzo - https://github.com/fredzo

Project Link: https://github.com/fredzo/esp32-snake