Working read code with mode button

Dependencies:   SDFileSystem emic2 mbed-rtos mbed

Fork of BAT_senior_design_Testnew by BAT

Revision:
40:091b6a852074
Parent:
39:d873136dfb12
Child:
41:dd382f4546aa
--- a/main.cpp	Fri Dec 01 03:36:28 2017 +0000
+++ b/main.cpp	Sat Dec 02 01:52:25 2017 +0000
@@ -217,10 +217,10 @@
     // INITIAL RESET
     if (type == 0) {
         int reset = 1;
-        myTTS.speakf("SPlease setup the device by pressing down all the buttons.\r");
+        myTTS.speakf("SWelcome to Bat, the Braille Assistive Teacher. This device will help you learn how to write and type braille. Please 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);
+            wait(3);
             sprintf(braille, "%d%d%d%d%d%d", button1.getPress(), button2.getPress(),
                     button3.getPress(), button4.getPress(), button5.getPress(), button6.getPress());
             userinput = buttonarr.checkVal(braille);
@@ -270,7 +270,7 @@
         }
         myTTS.speakf("%s\r",presspin);
         myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
-        wait(1);
+        wait(2);
         //pc.printf("hello");
 
         //WORKS UP TO HERE
@@ -329,6 +329,7 @@
                 wrongpin = wrongpin + " are wrong. Please try again.";
                 myTTS.speakf("%s\r",wrongpin);
                 myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
+                wait(2);
                 //UPDATE THE PINS THAT ARE WRONG BY CHECKING AGAIN BELOW
                 //char* braille;
                 if (type == 0) {
@@ -365,6 +366,7 @@
                 if(userinput == 'Z') {
                     reset = 0;
                 } else {
+                    wait(2);
                     myTTS.speakf("SPlease try again.\r");
                     myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
                 }
@@ -385,12 +387,14 @@
 // check what letters were wrong
 // give wrong letters - correct spelling is...
 
+    //SETTING UP SERVOS TO RELEASE FOR TYPING MODE FREEZES THE CODE
+    //buttonarr.setup(); //Reset servos so that buttons are up for typing mode
     string currword;
     int wordsize = sizeof(word)/sizeof(word[0]);
 
-    myTTS.speakf("SLet us now put these letters together to form words. Please reset buttons after each letter. Press down the submit button when done.\r");  // Send the desired string to convert to speech
+    //myTTS.speakf("SLet us now put these letters together to form words. Please reset buttons after each letter. Press down the submit button when done.\r");  // Send the desired string to convert to speech
+    myTTS.speakf("SPlease switch the device into typing mode. Press down the submit button when done.\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 < wordsize; i++) {  //iterate through the word array
         currword = word[i];
         string presspin = "To type the word ";
@@ -399,7 +403,7 @@
         for (int j = 0; j < currword.length(); j++) {
             presspin = presspin + ", "+ currword[j];
         }
-        //myTTS.speakf("S%s\r", presspin);
+        //myTTS.speakf("S%s\r", presspin); //UNCOMMENTING HERE WILL MESS UP READ/WRITE CODE
         //myTTS.ready();
     }