Words in Typing mode
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_Type_word by
Diff: main.cpp
- Revision:
- 38:68f7f54b723b
- Parent:
- 37:d873136dfb12
- Child:
- 39:8cc80f0b4398
--- a/main.cpp Fri Dec 01 03:36:28 2017 +0000 +++ b/main.cpp Sat Dec 02 01:49:48 2017 +0000 @@ -142,7 +142,7 @@ // servos begin at 30 degrees // replace with a button setup function - buttonarr.setup(); + //buttonarr.setup(); //buttonarr.setMode(); //led1 = 1; @@ -206,21 +206,20 @@ int type = 0; //TEXT-TO-SPEECH LOGIC - myTTS.volume(1); //max volume + myTTS.volume(1); //max volume is 18 myTTS.voice(2); - //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 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 +269,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 +328,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,13 +365,14 @@ 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 } } } //pc.printf("wrongpins are: %d", wrongpins[0]); - } + }*/ // WORD CODE @@ -385,12 +386,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,11 +402,11 @@ 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(); } - /* + // loop through each of the words for(int i = 0; i < wordsize; i++) { //iterate through the word array currword = word[i]; @@ -465,7 +468,7 @@ } } - }*/ + } // MAIN THREAD while(true) {