working type letter with mode button

Dependencies:   SDFileSystem emic2 mbed-rtos mbed

Fork of BAT_Type_letter by BAT

Revision:
27:b2e53ce54b3e
Parent:
23:23970cf718ee
Child:
28:3c4ebc4fde0f
--- a/main.cpp	Fri Nov 10 15:59:21 2017 +0000
+++ b/main.cpp	Fri Nov 10 16:22:04 2017 +0000
@@ -128,6 +128,7 @@
 
 int main()
 {
+
     /*
     // SETUP
     // pull up the pushbutton to prevent bouncing
@@ -137,38 +138,11 @@
     pb4.mode(PullUp);
     pb5.mode(PullUp);
     pb6.mode(PullUp);
-    wait(.001);
+    wait(.001); */
 
     // servos begin at 30 degrees
     // replace with a button setup function
-    for(int i=0; i<=3; i++) {
-        myservo = i/100.0;
-        wait(0.01);
-    }
-    for(int i=0; i<=3; i++) {
-        myservo2 = i/100.0;
-        wait(0.01);
-    }
-
-    for(int i=0; i<=3; i++) {
-        myservo3 = i/100.0;
-        wait(0.01);
-    }
-
-    for(int i=0; i<=3; i++) {
-        myservo4 = i/100.0;
-        wait(0.01);
-    }
-
-    for(int i=0; i<=3; i++) {
-        myservo5 = i/100.0;
-        wait(0.01);
-    }
-
-    for(int i=0; i<=3; i++) {
-        myservo6 = i/100.0;
-        wait(0.01);
-    }*/
+    buttonarr.setup();
 
     //led1 = 1;
     //led2 = 1;
@@ -246,6 +220,7 @@
     // check result
     // play results on speaker
     // save results
+    
     char currletter;
     int lettersize = sizeof(letter)/sizeof(letter[0]);
     for (int i = 0; i < lettersize; i++) {
@@ -253,13 +228,23 @@
         pc.printf("currletter %c \n", currletter);
         pc.printf("braille %s \n", buttonarr.getBraille(currletter));
     }
+    
     int* pinsup = buttonarr.pinsUp('M');
-    pc.printf("pins up M: %d \n", pinsup[0]);
-    pc.printf("pins up M: %d \n", pinsup[1]);
-    pc.printf("pins up M: %d \n", pinsup[2]);
+    int currpress;
+    // get what pins to press
+    for (int i = 1; i <= pinsup[0]; i++) {
+        // speaker stuff
+        currpress = pinsup[i];
+    }
+
     int* wrongpins = buttonarr.wrongPins('M', 'O');
-    pc.printf("wrong pins M & O %d \n", wrongpins[0]);
-    pc.printf("wrong pins M & O %d \n", wrongpins[1]);
+    int currwrong;
+    // get what pins are wrong
+    for (int i = 1; i <= wrongpins[0]; i++) {
+        // speaker stuff
+        currwrong = wrongpins[i];
+    }
+
     //pc.printf("current braille %c \n", buttonarr.checkVal());
     //pc.printf("%c\n", buttonarr.releaseButtons());