Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed TTU_CSC1300
Diff: main.cpp
- Revision:
 - 2:b46e9d2446cc
 - Parent:
 - 1:4e747357be1d
 - Child:
 - 3:0de5da8ecede
 
--- a/main.cpp	Sun Apr 11 05:03:42 2021 +0000
+++ b/main.cpp	Mon Apr 12 02:02:46 2021 +0000
@@ -11,16 +11,6 @@
 
 int main()
 {
-    //led0 flashes with a delay of 10 ms
-    led0 = TRUE;
-    wait_ms(10);
-    led0 = FALSE;
-    
-    //speaker beeps with a delay of 10 ms
-    speaker = TRUE;  
-    wait_ms(10);    
-    speaker = FALSE;
-    
     while(TRUE){
         
         float potVolt = pot.read();
@@ -28,18 +18,15 @@
         bool sw5_pressed = sw5;
         bool sw4_pressed = sw4;
         if(sw5_pressed && delay > 35 || sw4_pressed){
-            //led0 flashes with a delay related to the voltage readings of potentiometer
+            //led0 and speaker flash/beep with a delay related to potentiometer reading
             led0 = TRUE;
+            speaker = TRUE;
             wait_ms(delay);
             led0 = FALSE;
-            wait_ms(delay);
-        
-            //speaker beeps with a delay related to the voltage readings of poteniometer
-            speaker = TRUE;  
-            wait_ms(delay);    
             speaker = FALSE;
             wait_ms(delay);
         }else{
+            //speaker only beeps with delay related to potentiometer reading
             speaker = TRUE;  
             wait_ms(delay);    
             speaker = FALSE;