Memory Card Matching Game
Project By:
Krish Ravindranath and Kristen Fernandez
Overview
For this lab we have made a memory card matching game using the the mbed LPC 1768. A navigation switch is used for player control, and a uLCD, speaker, SD Card, Audio Amp, and potentiometer are used for visual and audio effects.
How to Play
When the game is started, 16 cards are shown on the screen in the flipped down position. Using the joystick, the user can navigate to any of the 16 cards. When the user presses down on the joystick, this flips the selected card over into the face up position. This reveals a unique shape and color combination. This first card will remain visible until the user navigates to and selects a second card. If the two flipped cards are a match (same color and same shape), then the user earns a point and two cards will be removed from the board. Otherwise, they will briefly remain visible before returning to the flipped down position. To win, the user must find all 8 matching pairs in 60 seconds before the game is over. At the end of the game, the user’s score will appear on the screen. The locations and shapes are randomly generated at the start of each game, so the user can reset the mbed and enjoy a brand new game.
Components
- Navigation Switch (Joystick): A navigation switch was used to allow the user to choose a card and flip it over by moving the switch in one of four directions and then pressing down on the navigation switch. More information on this component can be found at: https://developer.mbed.org/users/4180_1/notebook/using-a-navigation-switch-digital-joystick/
- uLCD-144-G2: This LCD module was used to display the graphics and provide the user interface for the game. More information on this component can be found at: https://developer.mbed.org/users/4180_1/notebook/ulcd-144-g2-128-by-128-color-lcd/
- Speaker: The speaker was used to add sound effects to the game. Effects are played whenever the user selects a card and also when the user successfully makes a match. More information on this component can be found at: https://developer.mbed.org/users/4180_1/notebook/using-a-speaker-for-audio-output/
- TPA2005D1 Class D Audio Amp: This allows for higher quality sound with a power efficient design. More information on this component can be found at: https://developer.mbed.org/components/TPA2005D1-Class-D-Audio-Amp/
- 10K Potentiometer: A potentiometer can be easily wired to the Audio Amp to act as a volume control for the sound effects. More information on this component can be found at: https://developer.mbed.org/components/Potentiometer/
- SD Card File System: The memory required for audio files is too large for an mbed’s memory, so an SD card is used to store the files that are used for the sound effects. More information on this component can be found at: https://developer.mbed.org/cookbook/SD-Card-File-System
Wiring
mbed | uLCD |
---|---|
VU | +5V |
p27 | TX |
p28 | RX |
p26 | RES |
GND | GND |
mbed | Navigation Switch |
---|---|
GND | - |
p9 | U - up |
p8 | C - center or fire |
p7 | L - left |
p6 | D -Down |
p5 | R - right |
mbed | MircroSD Breakout |
---|---|
GND | GND |
Vout | VCC |
p14 | CS |
p11 | DI |
p13 | SCK |
p12 | DO |
mbed | TPA 2005d1 Audio Amp | Speaker | 10k Potentiometer |
---|---|---|---|
GND | PWR -, IN- | ||
Vout | PWR+ | ||
p18 | IN + | ||
OUT + | + | ||
OUT - | - | ||
VOL (3 pints) | The three pot pins are connected adjacent to the three 3 VOL pins |
Pictures
Overview
(Wiring of GND and Power of SD Card is done beneath the breakout)
Game in play
Video
Code
Import programMemory_Card_Game
ECE 4180 Spring 2016 Lab 4
Please log in to post comments.