Piano Tiles game

Overview

This mbed mini-project creates a game called “Piano Tiles”, where the user has to tap on the black tiles while avoiding the white tiles. Each correct tap results in a musical tone played, and taps in quick succession plays the famous song Fur Elise. The capacitive touchpad serves as the touchpad for input signals to the mbed. The score is measured on how fast it takes the player to achieve a score of 100 correct taps. An online demo is available to be played here: https://scratch.mit.edu/projects/21596393/

Hookup Guide

The mbed to different device hookups are shown below:

/media/uploads/clu67/image1.jpg

uLCD-144-G2

mbeduLCD Header
VU = 5VuLCD Header
GndGnd
P28RX
P27TX
P30Reset

MPR121 I2C Capacitive Touch Sensor

mbedTouch KeypadPullups
GndGnd
P9SDA4.7K
P10SCL4.7K
P26IRQ
Vout (3.3 V)Vcc

SDFileSystem

mbedSDFileSystem
P8CS
P5DI
VoutVcc
P7SCK
GndGnd
P6DO
CD

Speaker

mbedTPA2005D1SpeakerPotentiometer
GndPwr -
Vout (3.3 V)Pwr +
P21, P18In+
Out ++
Out --
Volplug

Note

An external power supply might be needed to hook up to the TPA2005D1 and speaker chip since the mbed might not be able to supply power to all the components. If it is needed, hook up 5V to Pwr+ on the TPA2005DA chip and Gnd to a common ground.

Program

The objective of the game is to achieve a score of 100 as fast as possible without tapping a white tile. It starts off initializing tiles for the first four notes being played. The game starts as soon as you press on the first tile. The tiles update themselves after every black tile is hit. The placement of the black tiles are based on the tone of the note that is being played. If a white tile is hit, the game stops and you get a game over screen if your score is less than 100. A song will play when the game ends.

MPR121 touchpadTile on LCD screen
0Left Tile
4Middle Tile
8Right Tile

/media/uploads/clu67/image2.jpg

Video

Code/Library

Import programPianoTiles

an mbed tile music game using a capacitive touchpad and uLCD

Further Implementations

  • Add more songs to the start menu so the user can choose which song they would like to play.
  • Add a moving piano tiles option to the menu.
  • Complex and more detailed graphics
  • Better music synchronization by determining the length of all the notes


Please log in to post comments.