This program is to play wave file through sd card
Dependencies: mbed wave_player SDFileSystem
Diff: main.cpp
- Revision:
- 0:0ed9e25c735f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 24 06:28:15 2011 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" +#include "wave_player.h" +#include "SDFileSystem.h" + +SDFileSystem sd(p5, p6, p7, p8, "sd"); +AnalogOut DACout(p18); +wave_player waver(&DACout); + +int main() { + + mkdir("/sd/wf/", 0777); // make the directory to the SD card + // 0777 is the default mode so to have the widest access + + FILE *fp = fopen("/sd/wf/Hello.wav", "r"); + + if(fp == NULL){ + printf("File couldn't open\n"); + } + + while (1) + { + waver.play(fp); + fseek(fp, 0, SEEK_SET); // set file poiter to beginning + wait(3.0); + printf("File Playing\n"); + } + fclose(fp); +} \ No newline at end of file