/* Sample code to control a WTV020-SD-16P module Created by Diego J. Arevalo, August 6th, 2012 for Arduino plaform Modified by Kamil Kanas, 17/5/2017 for mbed platforms Tested with FRDM KL25Z board Released into the public domain 9/6/2017. */

Dependencies:   WTV020SD16 mbed

main.cpp

Committer:
kanatronics
Date:
2017-06-09
Revision:
1:49a77068c9e4
Parent:
0:8fe19aad9863

File content as of revision 1:49a77068c9e4:

#include "mbed.h"
#include "WTV020SD16.h"
//Released 9/6/2017 K.Kanas
                      
int main() {
   
   Wtv020sd16p wtv020sd16p;                                            // Creating an instance   
   wtv020sd16p.reset();                                                // reset module
    while(1) {  
  //Plays synchronously an audio file. Busy pin is used for this method.
  wtv020sd16p.playVoice(0);
  //Plays asynchronously an audio file.
   wait_ms(2000);
  wtv020sd16p.asyncPlayVoice(1);
  //Plays audio file number 1 during 2 seconds.
  wait_ms(5000);
  //Pauses audio file number 1 during 2 seconds.  
  wtv020sd16p.pauseVoice();
  wait_ms(2000);
  //Resumes audio file number 1 during 2 seconds.
  wtv020sd16p.pauseVoice();
  wait_ms(2000);  
  //Stops current audio file playing.
  wtv020sd16p.stopVoice();
  //Plays synchronously an audio file. Busy pin is used for this method.  
  wtv020sd16p.asyncPlayVoice(2);
  wait_ms(7000);   
  //Mutes audio file number 2 during 2 seconds.
  wtv020sd16p.mute();
  wait_ms(4000);
  //Unmutes audio file number 2 during 2 seconds.
  wtv020sd16p.unmute();
  wait_ms(2000);    
  //Stops current audio file playing.
  wtv020sd16p.stopVoice();
    
    
    }
}