Working reset, flipped logic

Dependencies:   SDFileSystem emic2 mbed-rtos mbed

Fork of BAT_senior_design_Nhi by BAT

Revision:
35:593bae6b342b
Parent:
34:1248dfa0740b
Child:
36:d873136dfb12
--- a/main.cpp	Wed Nov 29 15:14:26 2017 +0000
+++ b/main.cpp	Thu Nov 30 22:07:00 2017 +0000
@@ -255,6 +255,27 @@
 
     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
+    char* braille;
+    char userinput;
+
+    // INITIAL RESET
+    int reset = 1;
+    myTTS.speakf("SPlease setup the device by pressing down all the buttons.\r");
+    myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
+    while(reset == 1) {
+        wait(2);
+        sprintf(braille, "%d%d%d%d%d%d", button1.getPress(), button2.getPress(),
+                button3.getPress(), button4.getPress(), button5.getPress(), button6.getPress());
+        userinput = buttonarr.checkVal(braille);
+        if(userinput == 'Z') {
+            reset = 0;
+        } else {
+            //reset = 0;
+            myTTS.speakf("SSetup failed. Please try again.\r");
+            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
         char currletter = letter[i][0];
         //pc.printf("letter: %c \n", currletter);