James Heavey / Mbed 2 deprecated EL17JH

Dependencies:   mbed

Revision:
127:5994f1a186e0
Parent:
124:d635e3154bf3
Child:
128:b57930585692
--- a/main.cpp	Wed May 08 21:02:49 2019 +0000
+++ b/main.cpp	Wed May 08 21:18:07 2019 +0000
@@ -153,11 +153,11 @@
         lcd.printString(" >",0,pointer);
         lcd.refresh();
         wait(0.1);
-        if (pad.check_event(Gamepad::L_PRESSED) && pointer > 1) {  // if L is pressed and pointer isnt already on START, move it up one line
+        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
-        } else if (pad.check_event(Gamepad::R_PRESSED) && pointer < 3) {  // if R is pressed and pointer isnt already on HOW TO PLAY, move it down one line
+        } 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
@@ -207,11 +207,11 @@
         lcd.drawRect(42,30,40 * pad.read_pot() + 1,10,FILL_BLACK); // have it so it fills half the transparent one (default position)
         lcd.refresh();
         wait(0.1);
-        if (pad.check_event(Gamepad::L_PRESSED) && pointer > 1) {  // if L is pressed and pointer isnt already on JOYSTICK, move it up one line
+        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
-        } else if (pad.check_event(Gamepad::R_PRESSED) && pointer < 2) {  // if R is pressed and pointer isnt already on TILT, move it down one line
+        } 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
@@ -252,7 +252,7 @@
 
     while (pad.check_event(Gamepad::B_PRESSED) == false) { // while B is not pressed to return to main menu, display instruction on how to interact with the game
 
-        if (pad.check_event(Gamepad::R_PRESSED)) {
+        if (pad.get_direction() == S) {
             lcd.clear();
             lcd.printString(" CONTINUE TO  ",0,2);
             lcd.printString("INCREASE SCORE.  ",0,3);
@@ -262,7 +262,7 @@
             lcd.refresh();
             wait(0.1);
         }
-        if (pad.check_event(Gamepad::L_PRESSED)) {
+        if (pad.get_direction() == N) {
             lcd.clear();
             lcd.printString("   B = LASER  ",0,0);
             lcd.printString(" START = PAUSE  ",0,1);