Demo Team / Mbed 2 deprecated bluefruit

Dependencies:   mbed

Revision:
3:b519acc65986
Parent:
2:98ab6e6dd8aa
Child:
4:4775701a0d62
--- a/main.cpp	Wed Sep 24 09:29:23 2014 +0000
+++ b/main.cpp	Wed Sep 24 13:39:48 2014 +0000
@@ -75,7 +75,8 @@
     twobuttons = 0;
     times2[j] = t2.read_ms();
     subtractor = times2[j];
-    pc.printf("\n\r Double Key Press Time: %d \n", times2[j]);
+    pc.printf("\n\r Double Key Press Time: %d", times2[j]);
+    //pc.printf("\n\r Subtractor: %d \n", subtractor);
     j++;
 }
 
@@ -128,10 +129,20 @@
     }
     pc.printf("\n\r Position: %d", i);
     t.stop();
-    times[i] = t.read_ms()-subtractor;
+    //unsigned long long test = t.read_ms();
+    //pc.printf("\n\r Test: %d", test);
+    //pc.printf("\n\r Subtractor: %d", subtractor);
+    if (subtractor > 0) {
+        times[i] = 0;
+        }
+        else
+        {
+    times[i] = t.read_ms();
+    }
     pc.printf("\n\r Gap Time: %d", times[i]);
     t.reset();
     i++;
+    subtractor = 0;
 }
 
 void twobutton_instant(char n)
@@ -290,7 +301,6 @@
 
 void OneButton(char q)
 {
-    subtractor = 0;
     if (twobuttons) {
         twobutton_handler();
     }
@@ -525,7 +535,6 @@
                 break;
             case 5:
                 pc.printf("\n\r Move: Up + Right");
-                pc.printf("\n\r Position: %d", k);
                 t3.start();
                 while(t3.read_ms() < times2[k]) {
                     upswitch = 0;
@@ -880,7 +889,7 @@
         playI.rise(&playfunction);
         if (bluefruit.readable()) {
             bluefruit.gets(buf, 9);
-            pc.puts(buf);
+            //pc.puts(buf);
             comparison(buf);
 
         }