Card-Match Game w/MPR121 Touch Sensor and uLCD

Overview

For our project we made a 12-card matching game using the MPR121 I2C Capacitive Touch Sensor and the uLCD-144-G2 display. When the program is started the twelve card locations are shown, with each card switching through a sequence of random colors. After this the cards are put in the "flipped down" state, with only a blank white card being shown, and the game begins. Each card on the screen corresponds to a key on the touch sensor. When the sensor is touched, the respective card is "flipped" and its color is displayed. After the first card is flipped, it remains visible until a second card is chosen and flipped. If the two flipped cards are a match, they are removed from the board. Otherwise the two cards are flipped back down, and the process begins again. After each turn (2 card flips), the turn-count is incremented. When all twelve cards are matched and removed, the game ends, and a win screen is shown with the cards again cycling through random colors until a button is pressed, at which point the game resets. The goal of the game is to match all twelve cards in the least number of turns.

/media/uploads/jmccranie3/img_20141021_200031_066.jpg

/media/uploads/jmccranie3/img_20141021_200037_967.jpg

/media/uploads/jmccranie3/img_20141021_200050_374.jpg

/media/uploads/jmccranie3/img_20141021_200247_823.jpg

Components

  • Mbed LPC1768
  • MPR121 I2C Capacitive Touch Sensor
  • uLCD-144-G2

Circuit

MbedMPR121uLCD
GNDGNDGND
P9SDA
P10SCL
P26IRQ
VOut(3.3V)VCC
VU+5v
P28RX
P27TX
P29RES

Program

Import programMatchGame

A Card Matching Game using uLCD and Touchpad


Please log in to post comments.