The classic dueling tanks game for mbed.
Dependencies: 4DGL-uLCD-SE DRV2605 EthernetInterface Game_Synchronizer MMA8452 SDFileSystem SparkfunAnalogJoystick mbed-rtos mbed wave_player
Fork of 2035_Tanks_Shell by
Sound/playSound.cpp
- Committer:
- macenzofan
- Date:
- 2017-03-13
- Revision:
- 28:8dbb85f35be6
- Parent:
- 27:bd55ab4d137c
File content as of revision 28:8dbb85f35be6:
#include "playSound.h" #include "uLCD_4DGL.h" #include "SDFileSystem.h" #include "wave_player.h" extern uLCD_4DGL uLCD; extern wave_player player; // Given the filename of a .wav file in the SD card, play the file over the speaker. void playSound(char * wav) { // open wav file FILE *wave_file; wave_file=fopen(wav,"r"); if(wave_file == NULL){ uLCD.locate(0,4); uLCD.printf("Error in SD"); return; } // play wav file player.play(wave_file); // close wav file fclose(wave_file); }