mbed based wave player

Dependencies:   wave_player mbed

Fork of SDFileSystem_HelloWorld by mbed official

Files at this revision

API Documentation at this revision

Comitter:
berzin11295
Date:
Thu Jul 19 18:02:37 2018 +0000
Parent:
1:e4d7342be507
Commit message:
mbed based wave player

Changed in this revision

SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
WavPlayer.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/SDFileSystem.lib	Tue May 16 05:18:55 2017 +0000
+++ b/SDFileSystem.lib	Thu Jul 19 18:02:37 2018 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/SDFileSystem/#8db0d3b02cec
+https://os.mbed.com/users/berzin11295/code/SDFileSystem/#e4da4fff5733
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WavPlayer.lib	Thu Jul 19 18:02:37 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/teams/ECE-2035-TA/code/wave_player/#910a7c3c9b24
--- 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