![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
update
Dependencies: 4DGL-uLCD-SE mbed-rtos mbed wave_player
Fork of Lab3 by
Diff: Part2.cpp
- Revision:
- 2:d832b6c139d4
- Parent:
- 1:3af15e979565
- Child:
- 3:2adc8522c5e8
--- a/Part2.cpp Thu Oct 13 13:22:29 2016 +0000 +++ b/Part2.cpp Thu Oct 13 15:28:12 2016 +0000 @@ -36,7 +36,7 @@ // global variables int light = 0; // to keep track of lighting -int sound = 0; // to keep track of sound +int sound = 1; // to keep track of sound int sb_freq = 0.5; // rgb frequency int bright = 1; // time of the day @@ -154,15 +154,18 @@ while(true) { // thread loop lcd_mutex.lock(); // lcd_sem.wait(); - if (light == 0 && sound == 1) { + //if (light == 0 && sound == 1) { + if (light == 0) { // display red siren uLCD.filled_circle(SIZE_X/2, SIZE_Y/2, 10, RED); uLCD.filled_rectangle(SIZE_X/2 - 10, SIZE_Y/2, SIZE_X/2 + 10, SIZE_Y/2 + 30, RED); - } else if (light == 1 || sound == 0) { + //} else if (light == 1 || sound == 0) { + } else if (light == 1) { // display white siren uLCD.filled_circle(SIZE_X/2, SIZE_Y/2, 10, WHITE); uLCD.filled_rectangle(SIZE_X/2 - 10, SIZE_Y/2, SIZE_X/2 + 10, SIZE_Y/2 + 30, WHITE); - } else if (light == 2 && sound == 1) { + //} else if (light == 2 && sound == 1) { + } else if (light == 2) { // display blue siren uLCD.filled_circle(SIZE_X/2, SIZE_Y/2, 10, BLUE); uLCD.filled_rectangle(SIZE_X/2 - 10, SIZE_Y/2, SIZE_X/2 + 10, SIZE_Y/2 + 30, BLUE);