Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
playSound.cpp
00001 #include "playSound.h" 00002 #include "uLCD_4DGL.h" 00003 #include "SDFileSystem.h" 00004 #include "wave_player.h" 00005 00006 extern uLCD_4DGL uLCD; 00007 extern wave_player player; 00008 00009 // Given the filename of a .wav file in the SD card, play the file over the speaker. 00010 void playSound(char * wav) 00011 { 00012 // open wav file 00013 FILE *wave_file; 00014 wave_file=fopen(wav,"r"); 00015 00016 if(wave_file == NULL){ 00017 uLCD.locate(0,4); 00018 uLCD.printf("Error in SD"); 00019 return; 00020 } 00021 // play wav file 00022 player.play(wave_file); 00023 00024 // close wav file 00025 fclose(wave_file); 00026 }
Generated on Tue Jul 19 2022 20:07:14 by
1.7.2