James Heavey / Mbed 2 deprecated EL17JH

Dependencies:   mbed

Revision:
128:b57930585692
Parent:
127:5994f1a186e0
Child:
132:a98cfea2d292
diff -r 5994f1a186e0 -r b57930585692 main.cpp
--- a/main.cpp	Wed May 08 21:18:07 2019 +0000
+++ b/main.cpp	Wed May 08 21:32:23 2019 +0000
@@ -156,11 +156,11 @@
         if (pad.get_direction() == N && pointer > 1) {  // if L is pressed and pointer isnt already on START, move it up one line
             pointer -= 1;
             pad.tone(750.0,0.3);
-            wait(0.4);   // large wait time to reduce button bounce errors
+            wait(0.1);   // large wait time to reduce button bounce errors
         } else if (pad.get_direction() == S && pointer < 3) {  // if R is pressed and pointer isnt already on HOW TO PLAY, move it down one line
             pointer += 1;
             pad.tone(750.0,0.3);
-            wait(0.4);  // large wait time to reduce button bounce errors
+            wait(0.1);  
         }
         if (pad.check_event(Gamepad::X_PRESSED) & pad.check_event(Gamepad::Y_PRESSED)) {
             save_hi_score(0);  // resets hi score
@@ -210,11 +210,11 @@
         if (pad.get_direction() == N && pointer > 1) {  // if L is pressed and pointer isnt already on JOYSTICK, move it up one line
             pointer -= 1;
             pad.tone(750.0,0.3);
-            wait(0.4);  // large wait time to reduce button bounce errors
+            wait(0.1);  
         } else if (pad.get_direction() == S && pointer < 2) {  // if R is pressed and pointer isnt already on TILT, move it down one line
             pointer += 1;
             pad.tone(750.0,0.3);
-            wait(0.4);  // large wait time to reduce button bounce errors
+            wait(0.1);  
         }
 
         if (pad.check_event(Gamepad::A_PRESSED)) { // if A is pressed, switch the tilt option accordingly
@@ -302,7 +302,6 @@
         }
         if (pad.check_event(Gamepad::START_PRESSED)) { // if BACK pressed, toggle pause
             pause = !pause;
-            wait(0.4); // delay to help with button bounce
         }
 
         while (pause == true) { // if pause is true, display pause screen
@@ -313,7 +312,6 @@
             lcd.refresh();
             if (pad.check_event(Gamepad::START_PRESSED)) { // if START pressed, toggle pause, leaving pause screen
                 pause = !pause;
-                wait(0.4); // delay to help with button bounce
             }
             if (pad.check_event(Gamepad::BACK_PRESSED)) { // if BACK pressed, return to the title screen
                 reset_loss();
@@ -330,7 +328,7 @@
             victory_screen();
         }
         number_of_frames ++; // track the number of frames passed to add to the score (inversely proportional)
-        wait(1.0f/fps);
+        wait(1.0f/fps); // wait for 1 frame
     }
 }