Lab 3 Part 4
Dependencies: mbed wave_player mbed-rtos 4DGL-uLCD-SE SDFileSystem
Diff: main.cpp
- Revision:
- 16:f31b20cfeebc
- Parent:
- 15:e406620ee8af
diff -r e406620ee8af -r f31b20cfeebc main.cpp --- a/main.cpp Tue Mar 02 15:24:05 2021 +0000 +++ b/main.cpp Tue Mar 09 15:15:31 2021 +0000 @@ -151,16 +151,18 @@ /* Setting 1: Red */ if(setting == '1') { // Top Red Box - stdio_mutex.lock(); + //stdio_mutex.lock(); uLCD.filled_rectangle(0, 0, 127, 63, RED); - stdio_mutex.unlock(); + semlcd2.release(); + //stdio_mutex.unlock(); Thread::wait(750); semled.release(); semlcd2.release(); // Top Black Box - stdio_mutex.lock(); + //stdio_mutex.lock(); uLCD.filled_rectangle(0, 0, 127, 63, BLACK); - stdio_mutex.unlock(); + semlcd2.release(); + //stdio_mutex.unlock(); Thread::wait(750); sem_check.release(); semlcd1.wait(); @@ -171,16 +173,18 @@ /* Setting 2: Purple */ else if(setting == '2') { // Top Red Box - stdio_mutex.lock(); + //stdio_mutex.lock(); uLCD.filled_rectangle(0, 0, 127, 63, 0xFF00FF); - stdio_mutex.unlock(); + semlcd2.release(); + //stdio_mutex.unlock(); Thread::wait(750); semled.release(); semlcd2.release(); // Top Black Box - stdio_mutex.lock(); + //stdio_mutex.lock(); uLCD.filled_rectangle(0, 0, 127, 63, BLACK); - stdio_mutex.unlock(); + semlcd2.release(); + //stdio_mutex.unlock(); Thread::wait(750); sem_check.release(); semlcd1.wait(); @@ -191,16 +195,18 @@ /* Setting 3: Yellow */ else if(setting == '3') { // Top Red Box - stdio_mutex.lock(); + //stdio_mutex.lock(); uLCD.filled_rectangle(0, 0, 127, 63, 0xFFFF00); - stdio_mutex.unlock(); + semlcd2.release(); + //stdio_mutex.unlock(); Thread::wait(750); semled.release(); semlcd2.release(); // Top Black Box - stdio_mutex.lock(); + //stdio_mutex.lock(); uLCD.filled_rectangle(0, 0, 127, 63, BLACK); - stdio_mutex.unlock(); + semlcd2.release(); + //stdio_mutex.unlock(); Thread::wait(750); sem_check.release(); semlcd1.wait(); @@ -211,16 +217,18 @@ /* Setting 4: Black and White */ else if(setting == '4') { // Top Red Box - stdio_mutex.lock(); + //stdio_mutex.lock(); uLCD.filled_rectangle(0, 0, 127, 63, BLACK); - stdio_mutex.unlock(); + semlcd2.release(); + //stdio_mutex.unlock(); Thread::wait(250); semled.release(); semlcd2.release(); // Top Black Box - stdio_mutex.lock(); + //stdio_mutex.lock(); uLCD.filled_rectangle(0, 0, 127, 63, WHITE); - stdio_mutex.unlock(); + semlcd2.release(); + //stdio_mutex.unlock(); Thread::wait(250); sem_check.release(); semlcd1.wait(); @@ -237,15 +245,17 @@ /* Setting 1: Blue */ if(setting == '1') { // Bottom Black Box - stdio_mutex.lock(); + semlcd2.wait(); + //stdio_mutex.lock(); uLCD.filled_rectangle(0, 63, 127, 127, BLACK); - stdio_mutex.unlock(); + //stdio_mutex.unlock(); //Thread::wait(750); semlcd2.wait(); // Bottom Blue Box - stdio_mutex.lock(); + //stdio_mutex.lock(); + semlcd2.wait(); uLCD.filled_rectangle(0, 63, 127, 127, BLUE); - stdio_mutex.unlock(); + //stdio_mutex.unlock(); //Thread::wait(750); semlcd2.wait(); } @@ -253,15 +263,17 @@ /* Setting 2: Green */ else if(setting == '2') { // Bottom Black Box - stdio_mutex.lock(); + //stdio_mutex.lock(); + semlcd2.wait(); uLCD.filled_rectangle(0, 63, 127, 127, BLACK); - stdio_mutex.unlock(); + //stdio_mutex.unlock(); //Thread::wait(750); semlcd2.wait(); // Bottom Blue Box - stdio_mutex.lock(); + //stdio_mutex.lock(); + semlcd2.wait(); uLCD.filled_rectangle(0, 63, 127, 127, GREEN); - stdio_mutex.unlock(); + //stdio_mutex.unlock(); //Thread::wait(750); semlcd2.wait(); } @@ -269,15 +281,17 @@ /* Setting 3: Cyan */ else if(setting == '3') { // Bottom Black Box - stdio_mutex.lock(); + //stdio_mutex.lock(); + semlcd2.wait(); uLCD.filled_rectangle(0, 63, 127, 127, BLACK); - stdio_mutex.unlock(); + //stdio_mutex.unlock(); //Thread::wait(750); semlcd2.wait(); // Bottom Blue Box - stdio_mutex.lock(); + //stdio_mutex.lock(); + semlcd2.wait(); uLCD.filled_rectangle(0, 63, 127, 127, 0x00FFFF); - stdio_mutex.unlock(); + //stdio_mutex.unlock(); //Thread::wait(750); semlcd2.wait(); } @@ -285,15 +299,17 @@ /* Setting 4: Black and White */ else if(setting == '4') { // Bottom Black Box - stdio_mutex.lock(); + //stdio_mutex.lock(); + semlcd2.wait(); uLCD.filled_rectangle(0, 63, 127, 127, BLACK); - stdio_mutex.unlock(); + //stdio_mutex.unlock(); //Thread::wait(750); semlcd2.wait(); // Bottom Blue Box - stdio_mutex.lock(); + //stdio_mutex.lock(); + semlcd2.wait(); uLCD.filled_rectangle(0, 63, 127, 127, WHITE); - stdio_mutex.unlock(); + //stdio_mutex.unlock(); //Thread::wait(750); semlcd2.wait(); }