Mbed DDR
Overview
The objective of this project is to create a game on the mbed similar to the popular Dance Dance Revolution series. The MPR121 Capacitive Keypad serves as the input while the sound is being played on a different mbed. Unlike the Dance Dance Revolution games, the music does not have a specific arrow pattern as the program pseudo-randomly creates arrows during the game.
Note
We chose to use a second mbed to read from an SD card and play the .wav file from it due to performance dropping on the primary mbed when too many processes were running on it. A possible experiment is to use a .mp3 codec to play a music file instead.
Wiring
Primary Mbed
Mbed Pin | MPR121 Keypad |
---|---|
GND | GND |
P9 | SDA |
P10 | SCL |
P26 | IRQ |
VOut(3.3V) | VCC |
Note
In our setup, we used two 4.7 kilo-ohms resistors to pull up SDA and SCL since we did not have the breakout board for the MPR121 Capacitive Keypad.
Mbed Pin | uLCD(with cable) | uLCD(without cable) |
---|---|---|
Vu(5V) | +5V | +5V |
P27(RX) | RX | TX |
P28(TX) | TX | RX |
Gnd | Gnd | Gnd |
P29 | RES | RES |
Secondary Mbed
Mbed Pin | SD Card Reader | Amplifier |
---|---|---|
P5 | D1 | |
P6 | D0 | |
P7 | SCK | |
P8 | CS | |
P29 | Base(B) | |
Vout (3.3v) | VCC | |
GND | GND |
Interconnections between Mbeds
Primary Mbed | Secondary Mbed |
---|---|
P21 (start) | P26 |
P22 (stop) | P25 |
P23 (songOver) | P30 |
Program
The game begins at a start screen where a user can choose a difficulty. Currently there are 3 difficulties: easy, medium, and hard. After the game begins, there is a counter on the top right that corresponds to how many mistakes a user is allowed before game over. The counter initializes to 15 and decrements when a user misses an arrow, presses the wrong button, or presses the right button too early. The counter increments for every correct user input. The number of arrows hit correctly is shown in the top left corner of the screen.
MPR121 Key | Game Input |
---|---|
0 | Up arrow |
4 | Left arrow |
6 | Right arrow |
9 | Down arrow |
5 | Start button |
3 | Select Easy mode |
7 | Select Medium mode |
11 | Select Hard mode |
Main Program for Game
To be loaded on the primary Mbed.
Import programmbedDDR
1st half of mbed DDR game
Program for .wav Player
To be loaded on the secondary Mbed.
Import programMbedDDRSound
2nd half of mbed DDR
Demo
The video below shows a demo of the program.
Further Experimentation
- Create specific arrow sequences for different songs
- Using an .mp3 codec or other item to play music, possibly through the primary mbed
- Multiplayer functionality by adding another capacitive touchpad
- Adding song choice to the start menu in addition to difficulty
Please log in to post comments.