ver 1.0

Dependencies:   FATFileSystem SDFileSystem mbed-rtos mbed wave_player

Fork of LED_effects_w_sound by jim hamblen

LED PWM lighting effects with sounds played from *.wav files using threads and the mbed RTOS. For more info see http://developer.mbed.org/users/4180_1/notebook/led-lighting-effects-for-modelers/.

Files at this revision

API Documentation at this revision

Comitter:
4180_1
Date:
Tue Feb 20 17:54:41 2018 +0000
Parent:
10:21943bd35341
Commit message:
ver 1.0

Changed in this revision

FATFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
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-rtos.lib 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.lib Show annotated file Show diff for this revision Revisions of this file
wave_player_appbd.lib Show diff for this revision Revisions of this file
diff -r 21943bd35341 -r 50e44c84411c FATFileSystem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/FATFileSystem.lib	Tue Feb 20 17:54:41 2018 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/mbed-official/code/FATFileSystem/#28e685e5ff7f
diff -r 21943bd35341 -r 50e44c84411c SDFileSystem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Tue Feb 20 17:54:41 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/4180_1/code/SDFileSystem/#42e77fa78bf5
diff -r 21943bd35341 -r 50e44c84411c USBHost.lib
--- a/USBHost.lib	Fri Dec 05 18:16:56 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://mbed.org/users/mbed_official/code/USBHost/#37c948cf0dbf
diff -r 21943bd35341 -r 50e44c84411c main.cpp
--- a/main.cpp	Fri Dec 05 18:16:56 2014 +0000
+++ b/main.cpp	Tue Feb 20 17:54:41 2018 +0000
@@ -1,6 +1,11 @@
 #include "mbed.h"
-#include "USBHostMSD.h"
+#include "rtos.h"
+#include "SDFileSystem.h"
 #include "wave_player.h"
+
+
+SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card
+
 //LED lighting effects with sound using the RTOS
 //Plays the wave file "sample.wav" on the USB flash drive
 //using waveplayer code library
@@ -142,26 +147,20 @@
     }
 }
 
-//wave player plays a *.wav file to D/A and a PWM
-wave_player waver(&DACout,&PWMout);
+//wave player plays a *.wav file to D/A
+wave_player waver(&DACout);
 
 int main()
 {
-    USBHostMSD msd("usb");
+
     FILE *wave_file;
-    //setup PWM hardware for a Class D style audio output
-    PWMout.period(1.0/400000.0);
-    // wait until connected to a USB device
-    while(!msd.connect()) {
-        Thread::wait(750);
-    }
     while(1) {
         {
             //Lighthouse demo with foghorn
             Thread thread(lighthouse); //Start LED effect thread
             for(int i=0; i<4; ++i) {
                 //open wav file and play it
-                wave_file=fopen("/usb/foghorn.wav","r");
+                wave_file=fopen("/sd/foghorn.wav","r");
                 waver.play(wave_file); //Plays (*.wav file
                 fclose(wave_file);
                 Thread::wait(1925);
@@ -174,7 +173,7 @@
             //Arc Welding with sound
             Thread thread(welding);
             //open wav file and play it
-            wave_file=fopen("/usb/welding.wav","r");
+            wave_file=fopen("/sd/welding.wav","r");
             waver.play(wave_file);
             fclose(wave_file);
             //end of welding demo;
@@ -185,7 +184,7 @@
             //code block forces thread out of scope
             Thread thread(police);
             //open wav file and play it
-            wave_file=fopen("/usb/emgsiren.wav","r");
+            wave_file=fopen("/sd/emgsiren.wav","r");
             waver.play(wave_file);
             fclose(wave_file);
             //end of police light demo;
@@ -195,7 +194,7 @@
             //Fire with sound
             Thread thread(fire);
             //open wav file and play it
-            wave_file=fopen("/usb/fire.wav","r");
+            wave_file=fopen("/sd/fire.wav","r");
             waver.play(wave_file);
             fclose(wave_file);
             //end of fire demo;
@@ -206,7 +205,7 @@
             //RR Crossing Lights with Signal Bells
             Thread thread(rrcrossing);
             //open wav file and play it
-            wave_file=fopen("/usb/SignalBell.wav","r");
+            wave_file=fopen("/sd/SignalBell.wav","r");
             waver.play(wave_file);
             fclose(wave_file);
             //end of railroad crossing demo;
diff -r 21943bd35341 -r 50e44c84411c mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Tue Feb 20 17:54:41 2018 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#5713cbbdb706
diff -r 21943bd35341 -r 50e44c84411c mbed.bld
--- a/mbed.bld	Fri Dec 05 18:16:56 2014 +0000
+++ b/mbed.bld	Tue Feb 20 17:54:41 2018 +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/5571c4ff569f
\ No newline at end of file
diff -r 21943bd35341 -r 50e44c84411c wave_player.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wave_player.lib	Tue Feb 20 17:54:41 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/sravet/code/wave_player/#acc3e18e77ad
diff -r 21943bd35341 -r 50e44c84411c wave_player_appbd.lib
--- a/wave_player_appbd.lib	Fri Dec 05 18:16:56 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/4180_1/code/wave_player_appbd/#b1cea7afcfd2