FINAL VERSION

Dependencies:   mbed

Revision:
57:d498dd835cfc
Parent:
56:f9e586348e0b
Child:
58:a159cd976aca
--- a/main.cpp	Sun Apr 28 16:46:19 2019 +0000
+++ b/main.cpp	Tue Apr 30 10:06:46 2019 +0000
@@ -4,7 +4,7 @@
 #include "N5110.h"
 #include "BreakoutEngine.h"
 #include "Bitmap.h"
-#include<iostream>
+#include <iostream>
 #include "Sprites.h"
 //#include "MotionControl.h"
 
@@ -130,14 +130,13 @@
     
     int pointer = 2;
     
-    while (pad.check_event(Gamepad::A_PRESSED) || pad.check_event(Gamepad::B_PRESSED) == false) {
+    while (pad.check_event(Gamepad::B_PRESSED) == false) {
         lcd.clear();
         lcd.printString("   JOYSTICK ",0,2);    // start with default as joystick
         lcd.printString("   TILT ",0,3);   // choose between joystick and tilt
         lcd.printString(" >",0,pointer);
         lcd.refresh();  
         wait(0.1);
-        
         if (pad.check_event(Gamepad::L_PRESSED) && pointer > 2) {
             pointer -= 1;
             pad.tone(750.0,0.3);
@@ -148,15 +147,15 @@
             wait(0.1);
         }
         
-        if (pad.check_event(Gamepad::A_PRESSED) && pointer == 3) {
+        if (pad.check_event(Gamepad::A_PRESSED) {
             pad.tone(750.0,0.3);
             wait(0.1);
-            tilt = true;
-        } else if (pad.check_event(Gamepad::A_PRESSED) && pointer == 2) {
-            pad.tone(750.0,0.3);
-            wait(0.1);
-            tilt = false;
-        }
+            if (pointer == 2) {
+                tilt = false;
+            }
+            else if (pointer == 3) {
+                tilt = true;
+            }
         
         if (pad.check_event(Gamepad::B_PRESSED)) {
             pad.tone(750.0,0.3);