Progress Bar

Skip to main content

Jaycar
...

Memory Gesture Game

Memory Gesture Game

Difficulty
Entertainment

Summary

Using the well-known gesture sensor module (XC3742) and OLED Screen (XC3728) it will show patterns on the screen comprising of left, up, right, down, circle, and wave; try to match the patterns with your own hand! First level is short and easy to follow but it will get progressively faster and more complicated as you advance through the levels.

Materials Required

1Duinotech UNO r3 Main BoardXC4410
1Duinotech Arduino Compatible 1.3 Inch Monochrome OLED DisplayXC3728
1Duinotech Arduino Compatible Hand Gesture SensorXC3742
1150mm Plug to Socket Jumper Leads - 40 PiecesWC6028

The circuit is simple, there's only two components to connect in and to make it simplier we're going to do a naughty and power the OLED via pins 6 and 7. While this is not ideal, the OLED module uses very little power so the atmega is able to supply enough power from this happily. If you know how to change it, feel free to; we just put it there to make the wiring and presentation a little simpler.

The gesture sensor connects to the I2C lines, which are SDA->A4 and SCL->A5; You can power the sensor off either 3v3 or 5v as it has a little regulator on there to drop it down to the 3v3 supply.

Test

Table

with

some

random

data

The first step is to download and install the Arduino Integrated Development Environment (IDE) from 

. Arduino IDE is a software platform that allows you to write and upload code to the Arduino board.

2. Download Project Resources

Next, you will need to download the project resources from the top of this page. These resources include the code and other files required for the hand gesture game. Once you have downloaded the files, you will need to unzip them.

3. Open the memory file

Inside the unzipped files, there is a "memory" folder that contains the main code file for the hand gesture game. Open the "memory" file using Arduino IDE.

4. Download the library for OLED Display

The OLED display is a component that will be used in the hand gesture game. You will need to download the appropriate library for the OLED display to be able to use it with the Arduino board. There are several OLED libraries available, but we recommend using “U8g2” for this project. You can download this.

Library in Arduino IDE via the Library Manager (Sketch > Include Library > Manage Libraries) The gesture sensor library is already included in the project resources folder, so you don't need to worry about downloading it separately.

5. Select the Right Board and Port:

Before you can upload the code to the Arduino board, you need to make sure that the correct board and port are selected in the Arduino IDE. To do this, go to the "Tools" menu in Arduino IDE and select the appropriate board and port.

6. Verify and Upload the code

Once the board and port are selected, you can click on the "Verify" button in the Arduino IDE to check if the code is correct. If there are no errors, you can then click on the "Upload" button to upload the code to the board.

7. Play the Game

Congratulations! You have now successfully created your very own hand gesture game. You can now play the game by following the instructions provided with the game.

Adding more levels is easy; it's all added into the levels.h file

1 // this must be const, this must have a unique name (such as "level3" )
2 // and it must have PROGMEM before the equal sign to store it in flash
3 const uint8_t level3[] PROGMEM = {
4 GES_RIGHT_FLAG, //these are defined in paj7620.h, link them
5 GES_LEFT_FLAG,
6 GES_UP_FLAG,
7 GES_LEFT_FLAG,
8 GES_UP_FLAG,
9 GES_CLOCKWISE_FLAG,
10 FINISHED}; //you must end it with FINISHED, or a null byte

The position of the level will indicate how fast it goes; further down the list will be faster.

1 const uint8_t *const levels[TOTAL_LEVELS] PROGMEM = {
2 level1,
3 level2,
4 level3,
5 /* TODO, your level here */
6 level4,
7 level5};

This will allow all levels to be referenced

1 //at the top of the file
2 #include "paj7620.h"
3 #define FINISHED 0
4 #define TOTAL_LEVELS 5 //increase this to be the number of levels in the levels array

Use the instructions from our 

 project to generate a new title screen.

When you're on the title screen; wipe your hand over it to start the game.

It will then show you a pattern that you must memorise; after the pattern it will display "GO!" and you must replicate the pattern using the gesture sensor. You can make 5 mistakes for the entire length of the pattern, then it's game over; otherwise you move to the next level, which is a little faster, and longer, than the last.

To cheat and see the levels, check out levels.h file.

Similar projects you may be interested in

Entertainment
Arduino Learning
Difficulty

Entertainment
Music Beat Bar
Difficulty

Metronome
Entertainment
Metronome
Difficulty

Entertainment
Microbit Heart Finder
Difficulty