Vasanth Kumar / Mbed 2 deprecated RapidMP3_check

Dependencies:   RAPIDMP3 mbed

Fork of RapidMP3_check by Vasanth Kumar

Revision:
1:dbb63bd6c828
Parent:
0:a540b792fbf0
--- a/main.cpp	Fri Nov 21 07:39:09 2014 +0000
+++ b/main.cpp	Fri Nov 21 10:44:09 2014 +0000
@@ -2,30 +2,30 @@
 #include "RAPIDMP3.h"
 
 
-RAPIDMP3 rmp3(D8, D2);    /// Tx, Rx
+RAPIDMP3 rmp3(D8, D2);    // Tx, Rx
 Serial pc(USBTX, USBRX);
 
 int main() {
     
+    pc.puts("RAPID_MP3_V1 module demonstration\r\n");
+    
+    // After powering up, wait atleast a second before sending commands
     wait(1.0);  
-
-    pc.puts("RAPID_MP3_V1 module demonstration\r\n");
     
     while (1) {
         
         // Play track till its end
-        rmp3.playFile("munthi.mp3");
-        rmp3.waitEndOfPlay();
-                     
+        rmp3.playFile("track1.mp3");
+        rmp3.waitEndOfPlay();                    
                 
         // Play track for a specified duration
-        rmp3.playFile("sempove.mp3");
+        rmp3.playFile("track2.mp3");
         wait(20.0);
         rmp3.stop();        
-        wait(5.0);
+        wait(5.0);        
         
         // Play, pause and resume a track
-        rmp3.playFile("karug.mp3");
+        rmp3.playFile("track3.mp3");
         wait(10.0);
         rmp3.playPause();
         wait(5.0);        
@@ -44,28 +44,26 @@
         rmp3.volumeDec();
         wait(5.0);
                 
-        // Read and display current volume level in PC UART
+        // Get current volume level and send to PC
         uint8_t volume = rmp3.volumeGet();
         pc.printf("current volume level = %d\r\n", volume);
         wait(5.0);
         
-        // Read the playback status
+        // Read playback status
         uint8_t playStatus = rmp3.getPlaybackStatus();
         if (playStatus == RMP3_BUSY) {
-            pc.puts("Device is busy\r\n");
-            // Stop the current playback
-            rmp3.stop();                        
-            wait(5.0);
+            pc.puts("Device is busy\r\n");            
+            // Stop current playback
+            rmp3.stop();  
         }        
         pc.puts("Device is free\r\n");        
         wait(5.0);
         
-        // Record audio as .wav file for a specified time
+        // Record audio as .wav file for a specified duration
         rmp3.recordFile("rec_001.wav");
         wait(20.0);
         rmp3.stop();        
-        
-        
+                
         // Play the recorded audio till its end
         rmp3.playFile("rec_001.wav");
         rmp3.waitEndOfPlay();
@@ -74,75 +72,4 @@
         
         // loop again.
     }
-}
-
-
-//DigitalOut myled(LED1);
-
-///** Send Rapid MP3 response to PC */
-//static void sendResponse(uint8_t response) {
-//    if (response == RMP3_OK) {
-//        pc.puts("OK\r\n");
-//    } else if (response == RMP3_ER) {        
-//        pc.puts("ER\r\n");        
-//        /// error in command
-//        while (1) {
-//            myled = !myled;
-//            wait(0.2f);
-//        }
-//    }    
-//}
-
-
-
-//int main() {
-//
-//    /** Application Code.....*/    
-//    uint8_t response;
-//    
-//    pc.puts("RAPID_MP3_V1\r\n");
-//    
-//    
-//    /** Wait for RMP3 module Initialization (LED1 Indication) */
-//    response = rmp3.waitDeviceFree();
-//    pc.puts("Initialized Successfully\r\n");
-//    sendResponse(response);
-//    myled = 1;
-//    wait(1.0f);    
-//    
-//    
-//    /** Check RMP3 module communication */
-//    response = rmp3.checkDevice();    
-//    pc.puts("DEVICE CHECK\r\n");   
-//    sendResponse(response);
-//    wait(1.0f);
-//
-//
-//    while (1) {
-//        
-//        /** Play an MP3 file and wait till it gets completed */
-//        response = rmp3.playFile("munthi.mp3");        
-//        if (response == RMP3_OK) {       
-//            pc.puts("TRACK 1 started...\r\n");   
-//            rmp3.waitEndOfPlay();
-//            pc.puts("TRACK 1 ended\r\n");        
-//        }
-//        sendResponse(response);
-//        wait(1.0f);
-//    
-//    
-//        /** Play an MP3 file and stop it after 20 seconds */
-//        response = rmp3.playFile("sempove.mp3");        
-//        pc.puts("TRACK 2 started...\r\n");    
-//        sendResponse(response);
-//        wait(20.0f);
-//        response = rmp3.stop();
-//        pc.puts("TRACK 2 stopped after 20 sec\r\n");        
-//        sendResponse(response);
-//        
-//        /// wait before looping again...
-//        wait(5.0f);
-//    
-//    }   
-//
-//}
\ No newline at end of file
+}
\ No newline at end of file