2nd half of mbed DDR
Dependencies: PinDetect SDFileSystem mbed wave_player
Fork of WavePlayer_HelloWorld by
main.cpp
- Committer:
- jmelliadis3
- Date:
- 2014-04-29
- Revision:
- 2:bc774d066d69
- Parent:
- 1:5b8e223e983d
File content as of revision 2:bc774d066d69:
#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; 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; wave_file = fopen("/sd/letsgroove.wav", "r"); waver.play(wave_file, stopPlaying); playstop = false; fclose(wave_file); songOver = 1; } } }