Working reset, flipped logic

Dependencies:   SDFileSystem emic2 mbed-rtos mbed

Fork of BAT_senior_design_Nhi by BAT

Revision:
29:b9bd85682db1
Parent:
28:3c4ebc4fde0f
Child:
30:79cdf893c8b8
--- a/main.cpp	Wed Nov 15 16:27:26 2017 +0000
+++ b/main.cpp	Wed Nov 15 16:42:48 2017 +0000
@@ -164,6 +164,7 @@
 
     // PARSE INPUT FILE FOR LETTERS AND WORDS
     char delimiter = ',';
+    // TODO: fix the letters
     string letter[2];
     string word[2];
     char check;
@@ -223,15 +224,16 @@
     // check result
     // play results on speaker
     // save results
-    
+
     char currletter;
     int lettersize = sizeof(letter)/sizeof(letter[0]);
+    pc.printf("lettersize %d \n", lettersize);
     for (int i = 0; i < lettersize; i++) {
         currletter = letter[i][0];
         pc.printf("currletter %c \n", currletter);
         pc.printf("braille %s \n", buttonarr.getBraille(currletter));
     }
-    
+
     int* pinsup = buttonarr.pinsUp('M');
     int currpress;
     // get what pins to press
@@ -247,8 +249,7 @@
         // speaker stuff
         currwrong = wrongpins[i];
     }
-    
-    
+
     //TEXT-TO-SPEECH LOGIC
     myTTS.volume(18); //max volume
     string repeat = "Please try again.";
@@ -256,14 +257,15 @@
     myTTS.speakf("SWelcome to Bat, the Braille Assistive Teacher. This device will help you learn how to write and type braille.\r");  // Send the desired string to convert to speech
     myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
     for(int i = 0; i < lettersize; i++) {  //iterate through the letter array
-        int* pinsup = buttonarr.pinsUp('M');
+        char currletter = letter[i][0];
+        pc.printf("letter: %c \n", currletter);
+        int* pinsup = buttonarr.pinsUp(currletter);
         int currpress;
         int numpinsups = pinsup[0];  // size of array is first element of pinsup
         //string presspin;
         string presspin = "STo write the letter ";
         presspin = presspin + letter[i];
         presspin = presspin + ", press pins";
-        pc.printf("numpinsups %d", numpinsups);
 
         for (int j = 1; j < numpinsups; j++) {  // get what pins to press
             currpress = pinsup[j];
@@ -287,13 +289,12 @@
                     presspin = presspin + " 6,";
                     break;
             }
-
         }
-        myTTS.speakf("S%s\r",presspin);
-
+        myTTS.speakf("%s\r",presspin);
+        myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
     }
     //myTTS.speakf("STo write the letter %s, press pins %D\r",letter[i]);
-    myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
+    //myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
 
 
     //pc.printf("current braille %c \n", buttonarr.checkVal());