Movie and Music Trivia Game (with volume control)

ECE 4180 LAB 4

Project Description:

We chose option two for Lab 4, which was to create a mini mbed project. So my partner and I created a Music/Movie Trivia Game. It works by pressing the key pad for a song or movie sound bite to be played out the speaker. The title of the movie or song title/Artist is displayed on the Color LCD screen so that you can verify answer you guessed from listening to the sound bite. Also incorporated into this project is a volume control slider. The slider handle can be moved to change the volume on songs.

Code

Import programMOVIE_MUSIC_TRIVIA_GAME

USes Sdcard reader, uLCD display, Speaker, Keypad, and Potenitometer slider to control volume

Gallery

picture

Hardware

Keypad

Keypad PinMbed Pin
GNDGND
SDAp9
SCLp10
VCCVout

Don't forget to use pullup resistors on I2C More info on how to use sparkfun keypads can be found here: https://developer.mbed.org/components/MPR121-I2C-Capacitive-Touch-Keypad/

Sliding Potentiometer

Slider PinMbed Pin
GNDGND
VCCVout
Analogp20

Any Analog sensor could be used, the specifics on the one used in this project can be found here: http://www.phidgets.com/docs/1112_User_Guide

SdCard

SDMbed Pin
DOp6
GNDGND
SCKp7
VCCVOUT
DIp5
CSp8

More can be found on how SD Card System works here: http://developer.mbed.org/cookbook/SD-Card-File-System

uLCD

uLCDMbed Pin
5vVu
RXp27
TXp28
GNDVOUT
RESp30

More can be found on how uLCD works here: http://developer.mbed.org/users/4180_1/notebook/ulcd-144-g2-128-by-128-color-lcd/

How the Code Works

The song/movie sound bites are stored as .wav files on the sdCard and played out the speaker.

The volume control works using the timed TICKER interrupt set to happen every 0.25 seconds.

AnalogIn pot(p20);   // Potentiometer slider
Ticker timerz;

void volumechange() {
    ain = pot.read();
    vol = ((floor(ain*100)) );
    }

int main() {
...
...
...
timerz.attach(&volumechange, .25);
    while (1) {
...
...
...
}


Please log in to post comments.