mbed Guitar Hero

Description

This lab consists of a simplified recreation of the game, “Guitar Hero”. In terms of parts, it utilizes the uLCD screen, mbed, capacitive touchpad, speaker, sd file system, and push buttons. Within the code, there are two threads running in parallel. The first thread consists of the main function and runs the audio aspect of the code. This consists of opening a stored song on an sd card and playing it through the wired speaker. The second thread runs the gaming aspect of the code on the uLCD screen. On the uLCD screen, one will see a total score, a combo counter, four vertical columns with blocks, or notes, falling down, four target areas at the bottom of the columns, and a life bar at the right. The connected capacitive keypad is used to denote which note the player wants to hit; 0 corresponds to green, 1 to red, 2 to yellow, and 3 to blue. When the respective number is touched on the capacitive keypad and the corresponding note reaches the target area at the bottom of the screen, the player presses the wired pushbutton to simulate playing the note. Upon activation, the respective note will disappear from the screen and the score and combo counters will be updated. If the player misses the note, the score is not updated and the combo counter is reset to zero.

There are two ways for the game to end. Firstly, the player has a life bar displayed on the right side of the screen. If the player misses a note completely, or plays an incorrect note as it passes the target area, the player's life bar diminishes. If the player’s life bar diminishes completely, the game ends and “Game Over” will be displayed. However, as the game continues, the player can replenish a diminished life bar by hitting a consecutive number of notes in game. The second method for the game to end is by successfully reaching the end of the song, wherein the text “You Rock!” is displayed along with the total score and combo underneath.

The last aspect of the game to describe is the pause feature. A second wired push button implements this by setting a boolean value within the code. If the second button is pressed, then the game is paused and the text “Paused” is displayed on the screen. When pressed again, the game continues from where the player left.

Images

/media/uploads/gboggs3/guitar_hero.jpg

Hookup Guide

mbedMPR121: Capacitive Touch Sensor
GNDGND
p9SDA
p10SCL
N/AIRQ
VOUTVCC
mbeduLCD
VU+5v
p26RX
p27TX
GNDGND
p30RES
mbedMicroSD
N/ACD
p6DO
GNDGND
p7SCK
VOUTVCC
p5DI
p8CS
mbedPAM8302Speaker
GNDGND and A-
+3.3v or +5v (external)VIN
p18A+
8ohm (screw terminal +)+
8ohm (screw terminal -)-
Any DigitalOut PinSD

Video

Code

Import programGuitarHero

Simple implementation of Guitar Hero with mbed.


Please log in to post comments.