A wave player demo setup for the mbed application board. Reads a wave file from a USB flash drive, and outputs to the onboard speaker (very low volume) and the analog audio out jack that can be connected to a set of PC speakers for more volume. A wave file for the demo is available at http://mbed.org/media/uploads/4180_1/sample.wav. Copy it to the USB drive. See http://mbed.org/users/4180_1/notebook/application-board-waveplayer-demo/ for more details and instructions.

Dependencies:   USBHost mbed wave_player_appbd

Fork of USBHostMSD_HelloWorld by Samuel Mokrani

Revision:
1:473f339c54c1
Parent:
0:0d68fe822228
Child:
2:3e3df7a79050
--- a/main.cpp	Wed Mar 06 17:06:56 2013 +0000
+++ b/main.cpp	Tue Mar 12 17:30:04 2013 +0000
@@ -10,23 +10,30 @@
     
     while(1) {
         
-        // try to connect a USB flash disk
-        while(!msd.connect())
+        // try to connect a MSD device
+        while(!msd.connect()) {
+            Thread::wait(500);
+        }
+        
+        while(1) {
+            
+            FILE * fp = fopen("/usb/test1.txt", "a");
+        
+            if (fp != NULL) {
+                fprintf(fp, "Hello fun SD Card World: %d!\r\n", i++);
+                printf("Goodbye World!\r\n");
+                fclose(fp);
+            } else {
+                printf("FILE == NULL\r\n");
+            }
+            
             Thread::wait(500);
         
-        FILE * fp = fopen("/usb/test.txt", "a");
-        
-        if (fp != NULL) {
-            fprintf(fp, "Hello fun SD Card World: %d!\r\n", i++);
-            printf("Goodbye World!\r\n");
-            fclose(fp);
-        } else {
-            printf("FILE == NULL\r\n");
+            // if device disconnected, try to connect again
+            if (!msd.connected())
+                break;
         }
-        
-        // wait until the msd disk is disconnected
-        while(msd.connected())
-            Thread::wait(500);
+            
     }
 }