wave_player library problems
Dependencies: 4DGL-uLCD-SE EthernetInterface NTPClient PinDetect SDFileSystem mbed-rtos mbed wave_player
Fork of 4180_Final_Project by
Diff: main.cpp
- Revision:
- 6:8e926bbfaec0
- Parent:
- 5:3c880df67e2e
--- a/main.cpp Fri Apr 22 17:38:25 2016 +0000 +++ b/main.cpp Fri Apr 22 17:59:29 2016 +0000 @@ -41,6 +41,7 @@ // Current alarm time int curAlarmHour = 18; //0-23 int curAlarmMin = 9; +bool play = true; //time thread void time_thread(void const *args) @@ -61,6 +62,7 @@ void snooze_hit_callback (void) { myled1 = !myled1; + play = false; time_t newtime; struct tm * timeinfo; newtime = ct_time + snoozeTime; @@ -73,14 +75,18 @@ void off_hit_callback (void) { myled2 = !myled2; + play = false; + curAlarmMin = baseAlarmMin; + curAlarmHour = baseAlarmHour; } void play_file() { + bool* play_point = &play; FILE *wave_file; printf("\n\n\nHello, wave world!\n"); wave_file=fopen("/sd/bob.wav","r"); - waver.play(wave_file); + waver.play(wave_file, play_point); fclose(wave_file); } @@ -89,9 +95,9 @@ struct tm * timeinfo; timeinfo = localtime (&ct_time); if (timeinfo->tm_min == curAlarmMin && timeinfo->tm_hour == curAlarmHour) { - //playing = true; + play = true; + myled3 = true; play_file(); - myled3 = true; } } @@ -105,6 +111,7 @@ snooze.setSampleFrequency(); off.setSampleFrequency(); + play_file(); // Initialize LCD