Working read code with mode button
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_senior_design_Testnew by
Diff: main.cpp
- Revision:
- 41:dd382f4546aa
- Parent:
- 40:091b6a852074
diff -r 091b6a852074 -r dd382f4546aa main.cpp --- a/main.cpp Sat Dec 02 01:52:25 2017 +0000 +++ b/main.cpp Mon Dec 04 23:23:37 2017 +0000 @@ -393,7 +393,7 @@ 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("SPlease switch the device into typing mode. Press down the submit button when done.\r"); // Send the desired string to convert to speech + myTTS.speakf("S \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]; @@ -407,70 +407,6 @@ //myTTS.ready(); } - /* - // loop through each of the words - for(int i = 0; i < wordsize; i++) { //iterate through the word array - currword = word[i]; - string presspin = "To type the word "; - presspin = presspin + word[i]; - presspin = presspin + ", type letters "; - for (int j = 0; j < currword.length(); j++) { - presspin = presspin + ", "+ currword[j]; - } - myTTS.speakf("S%s\r", presspin); - myTTS.ready(); - - string wordinput = ""; - - // loop through each of the letters - //olduserinput; - int incorrect = 1; - //char userinput; - //char* braille; - - // while(!submit) - while (incorrect) { - // replace for loop with submit - // while (!submit) { - for (int j = 0; j < currword.length(); j++) { - //currletter = currword[j]; - // check if all buttons were pressed - wait(1); - - char* braille; - char* oldbraille; - - // wait for input - while (strcmp(braille, "000000") == 0) {} - - // while buttons have not been released - while (strcmp(braille, "000000") != 0) { - oldbraille = braille; - sprintf(braille, "%d%d%d%d%d%d", button1.getPress(), button2.getPress(), - button3.getPress(), button4.getPress(), button5.getPress(), button6.getPress()); - } - - // at the end of this, oldbraille contains the letter representation - // flip braille values - //userinput = checkVal(oldbraille); - wordinput[j] = buttonarr.checkVal(oldbraille); - //wordinput[j] = olduserinput; - } - - // check result of words - if (wordinput.compare(currword) == 0) { // input is correct - incorrect = 0; - myTTS.speakf("Good job!\r"); - myTTS.ready(); //ready waits for speech to finish from last command with a ":" response - } else { - incorrect = 0; // delete this line - myTTS.speakf("SPlease try again!.\r"); - myTTS.ready(); //ready waits for speech to finish from last command with a ":" response - } - } - - }*/ - // MAIN THREAD while(true) {