Tapton school Fido project audio function

Dependencies:   SDFileSystem mbed wave_player_appbd

Fork of AppBoard_Waveplayer by jim hamblen

Files at this revision

API Documentation at this revision

Comitter:
mptapton
Date:
Thu Feb 09 13:59:46 2017 +0000
Parent:
9:f1aebfbe7e78
Commit message:
TApton school Fido audio function

Changed in this revision

SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
USBHost.lib Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
wave_player_appbd.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Thu Feb 09 13:59:46 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/SDFileSystem/#8db0d3b02cec
--- a/USBHost.lib	Fri Nov 01 15:30:47 2013 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://mbed.org/users/mbed_official/code/USBHost/#37c948cf0dbf
--- a/main.cpp	Fri Nov 01 15:30:47 2013 +0000
+++ b/main.cpp	Thu Feb 09 13:59:46 2017 +0000
@@ -1,34 +1,51 @@
 #include "mbed.h"
-#include "USBHostMSD.h"
 #include "wave_player.h"
+#include "SDFileSystem.h"
+
 //mbed Application board waveplayer demo
-//Plays the wave file "sample.wav" on the USB flash drive
-//Outputs to onboard speaker (but at very low volume)
-//and the Audio Out jack for connection to a set of amplified PC speakers (at higher volume)
-//Needs a USB flash drive inserted with the wav file on it to run
+//Plays the wave file "sample.wav" on the SD drive
+//Outputs to p18 analogue out to an audio amp and speaker 
 
+ 
 //Analog Out Jack
 AnalogOut DACout(p18);
 //On Board Speaker
 PwmOut PWMout(p26);
 
+//SD card
+SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
 wave_player waver(&DACout,&PWMout);
 
 int main()
 {
-    USBHostMSD msd("usb");
+   char buffer[20];
     FILE *wave_file;
     //setup PWM hardware for a Class D style audio output
     PWMout.period(1.0/400000.0);
-    printf("\n\n\nHello, wave world!\n");
-    // wait until connected to a USB device
-    while(!msd.connect()) {
-        Thread::wait(500);
-    }
-    //open wav file and play it
-    wave_file=fopen("/usb/sample.wav","r");
+  while(1){
+    led1=1;
+    led2=0;
+    led3=1;
+    led4=0;
+     
+    for (int a=1;a<40; a++){
+    sprintf(buffer,"/sd/voice%d.wav",a);    
+    wave_file=fopen(buffer,"r");
     waver.play(wave_file);
     fclose(wave_file);
-    //end of program
-    while(1) {};
+    if (a%2!=0){
+    led1= !led1;
+    led2= !led2;
+    led3= !led3;
+    led4= !led4;
+     }
+    }
+    
+  }
 }
\ No newline at end of file
--- a/mbed.bld	Fri Nov 01 15:30:47 2013 +0000
+++ b/mbed.bld	Thu Feb 09 13:59:46 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/f37f3b9c9f0b
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/99b5ccf27215
\ No newline at end of file
--- a/wave_player_appbd.lib	Fri Nov 01 15:30:47 2013 +0000
+++ b/wave_player_appbd.lib	Thu Feb 09 13:59:46 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/4180_1/code/wave_player_appbd/#b1cea7afcfd2
+https://developer.mbed.org/users/mptapton/code/wave_player_appbd/#c056757cda3a