Eva Maffett / Mbed 2 deprecated EduBaseV2_Lab2

Dependencies:   mbed TTU_CSC1300

Revision:
1:c9aa78523331
Parent:
0:911c8f66a59d
Child:
2:651e6edca37a
--- a/main.cpp	Tue Mar 23 21:56:15 2021 +0000
+++ b/main.cpp	Tue Apr 13 03:06:38 2021 +0000
@@ -1,5 +1,5 @@
 /*
- *     Lab #:
+ *     Lab #: 8
  * Lab Title:
  * Author(s):
  *      Date:
@@ -19,13 +19,29 @@
         //WRITE SOLUTION HERE
         float f_value = pot.read(); //f_value > 0.0f && f_value < 1.0f
         f_value = (f_value * 25) + 20;
-        speaker = TRUE;  //will turn the speaker on, sending a single square wave
-        wait_ms(250);    //delays for 250 ms
-        speaker = FALSE; //will turn the speaker off
-        led0 = TRUE;
-        wait_ms(500);
-        led0 = FALSE;
-        wait_ms(500);
-        wait_ms(f_value);
+        
+        if (bool sw5_pressed = TRUE && f_value > 35){
+            speaker = TRUE;  //will turn the speaker on, sending a single square wave
+            wait_ms(250);    //delays for 250 ms
+            speaker = FALSE; //will turn the speaker off
+            led0 = TRUE;
+            wait_ms(500);
+            led0 = FALSE;
+            wait_ms(500);
+            wait_ms(f_value);   
+        } else if (bool sw4_pressed = true){
+            speaker = TRUE;  //will turn the speaker on, sending a single square wave
+            wait_ms(250);    //delays for 250 ms
+            speaker = FALSE; //will turn the speaker off
+            led0 = TRUE;
+            wait_ms(500);
+            led0 = FALSE;
+            wait_ms(500);
+            wait_ms(f_value); 
+        }
+        else{
+            speaker = TRUE;  
+            wait_ms(f_value); 
+        }
     }
 }