Whack a Mole game! Features: - LCD graphics display - Touch pad input - Speaker effects through a class D audio amplifier\ - A high score page maintained by the SD card file system - Analog noise used to seed random numbers
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed
Fork of MPR121_Demo by
Diff: main.cpp
- Revision:
- 6:ca03b9c94c88
- Parent:
- 5:070755be0a77
- Child:
- 7:5a8f9a018e1f
--- a/main.cpp Mon Mar 14 05:36:09 2016 +0000 +++ b/main.cpp Mon Mar 14 05:43:51 2016 +0000 @@ -35,6 +35,7 @@ DigitalOut led4(LED4); AnalogIn Ain(p15); +SongPlayer mySpeaker(p21); // Create the interrupt receiver object on pin 26 InterruptIn interrupt(p26); // Setup the Serial to the PC for debugging @@ -70,26 +71,32 @@ // LED demo mod by J. Hamblen if (value==256&&pos1==1) { + mySpeaker.PlaySong(note,duration); score++; } if (value==16&&pos2==1) { + mySpeaker.PlaySong(note,duration); score++; } if (value==1&&pos3==1) - { + { + mySpeaker.PlaySong(note,duration); score++; } if (value==512&&pos4==1) { + mySpeaker.PlaySong(note,duration); score++; } if (value==32&&pos5==1) { + mySpeaker.PlaySong(note,duration); score++; } if (value==2&&pos6==1) { + mySpeaker.PlaySong(note,duration); score++; } pc.printf("MPR value: %x \r\n", value);