![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Speaker
Dependencies: SDFileSystem mbed wave_player
main.cpp
- Committer:
- ldeng31
- Date:
- 2015-10-01
- Revision:
- 0:2ac76bf841ff
File content as of revision 0:2ac76bf841ff:
#include "mbed.h" #include "SDFileSystem.h" #include "wave_player.h" SDFileSystem sd(p5, p6, p7, p8,p9, "sd"); //SD card // speaker sound effect demo using PWM hardware output AnalogOut DACout(p18); wave_player waver(&DACout); //vector<string> filenames; //filenames are stored in a vector string bool PLAY = true; bool *PlayStopPtr = &PLAY; int main() { FILE *wave_file; wave_file=fopen("/sd/mySiFiTheme/The Imperial March.wav","r"); waver.play(wave_file,PlayStopPtr); fclose(wave_file); }