working type letter with mode button
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_Type_letter by
Diff: main.cpp
- Revision:
- 43:9fb92cb259fc
- Parent:
- 42:bdb6f132a609
--- a/main.cpp Mon Dec 04 19:57:53 2017 +0000 +++ b/main.cpp Tue Dec 05 03:33:11 2017 +0000 @@ -22,6 +22,7 @@ DigitalIn pb5 (p16); PwmOut myservo6(p26); DigitalIn pb6 (p15); +DigitalIn read (p29); //DigitalOut led1(LED1); //DigitalOut led3(LED3); @@ -116,6 +117,7 @@ pb4.mode(PullUp); pb5.mode(PullUp); pb6.mode(PullUp); + read.mode(PullUp); wait(.001); // PARSE INPUT FILE FOR LETTERS AND WORDS @@ -173,7 +175,7 @@ //int type = 0; //TEXT-TO-SPEECH LOGIC - myTTS.volume(3); //max volume is 18 + myTTS.volume(18); //max volume is 18 myTTS.voice(2); @@ -192,13 +194,15 @@ // check if correct letter // feedback // loop - + myTTS.speakf("SPlease switch the device into typing mode.\r"); // Send the desired string to convert to speech + myTTS.ready(); //ready waits for speech to finish from last command with a ":" response + while(read==1) {} for(int i = 0; i < lettersize; i++) { //iterate through the letter array char currletter = letter[i][0]; int* pinsup = buttonarr.pinsUp(currletter); int currpress; int numpinsups = pinsup[0]; // size of array is first element of pinsup - string presspin = "STo write the letter "; + string presspin = "STo type the letter "; presspin = presspin + letter[i]; presspin = presspin + ", press buttons"; @@ -322,8 +326,9 @@ myTTS.ready(); //ready waits for speech to finish from last command with a ":" response } } - } + myTTS.speakf("SThis is the end of the module.\r"); // Send the desired string to convert to speech + myTTS.ready(); //ready waits for speech to finish from last command with a ":" response // MAIN THREAD while(true) {