working type letter with mode button

Dependencies:   SDFileSystem emic2 mbed-rtos mbed

Fork of BAT_Type_letter by BAT

Revision:
15:7e9308d14faa
Parent:
14:581a3b02f4c3
Child:
16:5c91af9b4e7c
--- a/main.cpp	Sun Oct 22 22:20:11 2017 +0000
+++ b/main.cpp	Sun Oct 22 22:34:06 2017 +0000
@@ -66,12 +66,34 @@
 {
     // TODO: Add states
     while(true) {
-    // button was up and is moving down, move servo in
+        // state 0 - button is up, pb = 0
+        // if (pb == 0 && state == 3) {
+            // nothing happens here, servo is still
+            // state2 = 0;
+        //    }
+        // state 1 - button is moving down, pb = 1
+        // if (pb == 1 && state == 0) {
+            //button2.moveServoIn();
+            //state2 = 1;
+        //    }
+        // state 2 - button is down, pb = 0
+        // if (pb == 0 && state == 1) {
+            // nothing happens here, servo is still
+            // state2 = 2;
+        //    }
+        // state 3 - button is moving up, pb = 1
+        // if (pb == 1 && state == 2) {
+            //button2.moveServoOut();
+            //state2 = 3;
+        //    }
+        // state 4 - handle bouncing while button is down
+
+
+        // button was up and is moving down, move servo in
         if (pb2 == 1 && state2 == 2) {
-                button2.moveServoIn();
-                state2 = 1;
-                led2 = 0;
-                count = 0;
+            button2.moveServoIn();
+            state2 = 1;
+            led2 = 0;
         }
         // button was down and is being pushed again, move servo out
         else if (pb2 == 1 && state2 == 1) {
@@ -106,7 +128,7 @@
     //pb1.mode(PullUp);
     //pb2.mode(PullUp);
     //wait(.001);
-    
+
     // servo begins at 30 degrees
     // replace with a button setup function
     for(int i=0; i<=3; i++) {