guiiiii
Dependencies: mbed wave_player mbed-rtos SDFileSystem
Revision 3:f53cb35273f8, committed 2020-12-03
- Comitter:
- dimitryjl23
- Date:
- Thu Dec 03 19:41:11 2020 +0000
- Parent:
- 2:b2c4f3766090
- Commit message:
- some changes;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b2c4f3766090 -r f53cb35273f8 main.cpp --- a/main.cpp Thu Dec 03 16:09:24 2020 +0000 +++ b/main.cpp Thu Dec 03 19:41:11 2020 +0000 @@ -13,6 +13,7 @@ //char myline [MAXLINE]; //int i, inch ; string dir; +//string song = "africa-toto"; string song; bool play; Mutex speaker_lock; @@ -25,18 +26,19 @@ // check helper function for new song in GUI // grab file here and put together string // string song_title = "/sd/" + "" + ".wav"; - - FILE *wave_file; - dir = "/sd/" + song + ".wav"; - wave_file=fopen(dir.c_str(),"r"); - - speaker_lock.lock(); - if (play) { + + + if(play == true) + { + //speaker_lock.lock(); + FILE *wave_file; + dir = "/sd/" + song + ".wav"; + wave_file=fopen(dir.c_str(),"r"); waver.play(wave_file); + fclose(wave_file); + //speaker_lock.unlock(); } - speaker_lock.unlock(); - fclose(wave_file); - Thread::wait(100); + Thread::wait(1000); } } @@ -53,11 +55,13 @@ int main() { + + char c; Thread speaker(speaker_thread); - char c; + //led = 1; while(1) { - led = !led; wait(0.2); + while(!pc.readable()) { Thread::wait(1); } @@ -66,6 +70,7 @@ switch(c) { case '1': song = "africa-toto"; + //led = 1; break; case '2': song = "around_the_world-atc"; @@ -81,6 +86,7 @@ break; case '6': song = "Song1_test"; + //speaker.terminate(); break; case 'P': // wave_player plays @@ -89,10 +95,15 @@ case 'S': // wave_player stops play = false; + //led!=led; + //speaker.terminate(); break; default: break; } + + if(play==true){led=1;} + else{led=0;} } Thread::wait(200); }