Bejewelled On mBed

Overview

This project is a simple Bejewelled style game where the goal is to match 3 or more squares of the same color. The game board is displayed on a uLCD screen. Squares are chosen using a touch keypad, using a one to one mapping of touch keys to squares on screen. Additionally, a pushbutton is used to start the game and play again. The speaker is also used for sound effects, playing sounds from an SD card. The player has sixty seconds to score as much as possible after which the game stops, and displays the score. At this point a player can choose to play again.

Parts Used

Wiring

A wall adaptor is used to power the uLCD, this is not necessary and can be switched to mBed power. Also, instead of the SD card reader, a USB reader could also be used.

uLCD

mBeduLCD
p28 (tx)rx
p27 (rx)tx
p29reset
gndgnd
VU5v

In this circuit, an adaptor is used instead. Make sure to connect the ground of the adaptor to the ground of the mBed, but not the positive lines.

SD Breakout

mBedSD Card Breakout
p8CS
p 5DI
VOUTVCC
p7SCK
GNDGND
p6DO

Touch Keypad

mbedTouch Keypad
GndGnd
p9SDA
p10SCL
p21IRQ
Vout(3.3V)Vcc

The I2C pullups on SDA and SCL are not provided on the touch keypad board, so add two 4.7K ohm pullups to 3.3V to the circuit.

Speaker and Amp

mbedTPA2005D1Speaker
gndpwr - (gnd), in -
Vout (3.3V) or 5Vpwr +
p22 (any PWM or D/A)in +
out ++
out --

Additionally a pushbutton is connected to p19.

/media/uploads/keerthantito/img_4901.jpg

Code

Import programBejewelled_4180

A bejewelled style game on mBed.

Game Play


Please log in to post comments.