2nd half of mbed DDR
Dependencies: PinDetect SDFileSystem mbed wave_player
Fork of WavePlayer_HelloWorld by
Revision 2:bc774d066d69, committed 2014-04-29
- Comitter:
- jmelliadis3
- Date:
- Tue Apr 29 23:26:21 2014 +0000
- Parent:
- 1:5b8e223e983d
- Child:
- 3:ddef9c94e3ba
- Commit message:
- 2nd half of mbed DDR
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PinDetect.lib Tue Apr 29 23:26:21 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/AjK/code/PinDetect/#cb3afc45028b
--- a/main.cpp Thu Jan 24 02:59:05 2013 +0000 +++ b/main.cpp Tue Apr 29 23:26:21 2014 +0000 @@ -2,19 +2,53 @@ #include "mbed.h" #include "SDFileSystem.h" #include "wave_player.h" +#include "PinDetect.h" SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card AnalogOut DACout(p18); +InterruptIn stop(p25); +DigitalIn start(p26); +DigitalOut songOver(p30); +//DigitalIn start(p26); + + + +bool playstop = false; +bool *stopPlaying = &playstop; wave_player waver(&DACout); +//FILE *wave_file; -int main() -{ +void stop_rise() { + + playstop = !playstop; +} + +void stop_fall() { + + playstop = !playstop; +} + +int main(){ + + songOver = 0; + stop.rise(&stop_rise); + stop.fall(&stop_fall); + + + while (1) { + while(start == 0){}; + songOver = 0; + //printf("\n\n\nHello, wave world!\n"); + if (playstop == true) { FILE *wave_file; - printf("\n\n\nHello, wave world!\n"); - wave_file=fopen("/sd/sample.wav","r"); - waver.play(wave_file); + wave_file = fopen("/sd/letsgroove.wav", "r"); + waver.play(wave_file, stopPlaying); + playstop = false; fclose(wave_file); + songOver = 1; + } + } } \ No newline at end of file
--- a/wave_player.lib Thu Jan 24 02:59:05 2013 +0000 +++ b/wave_player.lib Tue Apr 29 23:26:21 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/sravet/code/wave_player/#acc3e18e77ad +http://mbed.org/users/sravet/code/wave_player/#5f2aef37d79a