mbed based wave player

Dependencies:   wave_player mbed

Fork of SDFileSystem_HelloWorld by mbed official

Revision:
2:ea62438661bf
Parent:
0:bdbd3d6fc5d5
diff -r e4d7342be507 -r ea62438661bf main.cpp
--- a/main.cpp	Tue May 16 05:18:55 2017 +0000
+++ b/main.cpp	Thu Jul 19 18:02:37 2018 +0000
@@ -1,19 +1,23 @@
 #include "mbed.h"
 #include "SDFileSystem.h"
+#include "WavPlayer.h"
  
-SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
- 
+SDFileSystem sd(PC_12,PC_11,PC_10,PD_2,"sd"); // the pinout on the mbed Cool Components workshop board
+
+AnalogOut dac(PA_5);
+DigitalOut enb(PA_12);
+WavPlayer player(&dac, &enb);
+
 int main() {
     printf("Hello World!\n");   
- 
-    mkdir("/sd/mydir", 0777);
     
-    FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
+    FILE *fp = fopen("/sd/voices/hello_0.wav", "r");
     if(fp == NULL) {
-        error("Could not open file for write\n");
+        error("Could not open file for read\n");
     }
-    fprintf(fp, "Hello fun SD Card World!");
-    fclose(fp); 
- 
-    printf("Goodbye World!\n");
-}
+    
+    player.play(fp);
+    
+    fclose(fp);
+    printf("Bye World!\n");   
+}
\ No newline at end of file