One of the simplest and more fun games from history is the famous “Snake” game. Do you remember to playing it from your old cell phone? Yes? Now you have the opportunity to remember old times following this very simple tutorial for Rhomb.io Class2 boards.
When you start a new game, the skanke is very short but if you “eat” some dots the size of the snake will increase and the game will be more difficult… And fun! When a player hits the wall or the tail of the snake, the score flashes on the screen.
If you press down the joystick the game will restart and the score will return to zero.
Bill of materials
- Rhomb.io Class 2 board. For example Phobos or Deimos.
- Duino uno or Duino mega Rhomb.io modules
- 8×8 LED Matrix driven by MAX7219 (available on major online stores)
- Analog 2-axis Thumb Joystick (available on major online stores)
- Micro USB cable
Setting up your board
Please follow the steps shown in this article for configuring your board and module for this and other experiments.
Wiring the components
Please, follow this simple schematic and connect all the pins and wires at their respective position.
Flashing the software
The first step is downloading the “snake game” folder from our github repository. Press the “clone or download” button at github.
Download and install the Arduino IDE. Our boards are compatible with Arduino stuff.
Connect the board to your PC and open the snake_game.ino file at the Arduino IDE. This project have 2 more files, they will be flashed automatically as dependencies when you flash the main project file.
Select the propper COM port of your PC and select the board type according to your master module:
- Arduino / Genuino UNO is compatible with Duino UNO Rhomb.io module
- Arduino / Genuino MEGA is compatible with Duino MEGA Rhomb.io module
Hit the “upload” button at Arduino IDE to start flashing your board with the new software. Once the process finishes, the job is done. You can now test the project and play to the snake game.
Source code originally developed by: Hannes Paulsson.
Minor changes and bug corrections by: Rhomb.io