inital commit
Dependencies: mbed wave_player mbed-rtos 4DGL-uLCD-SE SDFileSystem2 PinDetect MMA8452
Diff: main.cpp
- Revision:
- 7:71e9ee360b90
- Parent:
- 6:6315ecdd0b47
- Child:
- 9:08886cc06a5d
diff -r 6315ecdd0b47 -r 71e9ee360b90 main.cpp --- a/main.cpp Sun Dec 12 20:08:18 2021 +0000 +++ b/main.cpp Sun Dec 12 20:43:03 2021 +0000 @@ -132,7 +132,7 @@ uLCD.printf("%s", "^^^"); LCD.unlock(); } - Thread::wait(1000); + Thread::wait(500); } } void buttonThread() @@ -150,7 +150,7 @@ play=!play; myled=play; Speaker.unlock(); - Thread::wait(100); + Thread::wait(10); } void skipThread() { @@ -163,6 +163,11 @@ { currentsong=0; } + if(!menu) + { + playing=true; + play=true; + } } void backThread() { @@ -174,6 +179,11 @@ { currentsong=songcount-1; } + if(!menu) + { + playing=true; + play=true; + } } void menuThread() { @@ -188,6 +198,7 @@ { } + Thread::wait(100); } } void IMUThread(void const *argument) @@ -199,7 +210,7 @@ imu.readAccel(); avgIMU=int((((imu.ax+imu.az+imu.ay)/3.0)+avgIMU)/2); avgs.unlock(); - Thread::wait(2500); + Thread::wait(5000); } } @@ -247,20 +258,16 @@ Thread thread1(LCDThread); Thread thread4(BlueThread); Thread thread5(IMUThread); - while(1) - { - while(playing==true){ + while(1){ FILE *wave_file; Thread::wait(1000); mentex.lock(); string selectedSong= "/sd/myMusic/" + songList[currentsong]; mentex.unlock(); const char* song = selectedSong.c_str(); - uLCD.printf("%s",song); wave_file=fopen(song,"r"); if(wave_file==NULL) uLCD.printf("file open error!\n\n\r"); waver.play(wave_file); fclose(wave_file); } - } } \ No newline at end of file