text-to-speech hello world

Dependencies:   emic2 mbed SDFileSystem

Revision:
2:922b8fe6ff94
Parent:
0:c1e7994288d7
--- a/main.cpp	Fri Oct 27 14:37:19 2017 +0000
+++ b/main.cpp	Sat Nov 04 18:31:24 2017 +0000
@@ -1,26 +1,40 @@
 #include "mbed.h"
+#include <string>
+using namespace std;
 //Emic 2 Hello Speech World Demo
- 
+#include "SDFileSystem.h"
+
+SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
+
 DigitalOut myled(LED1);
 #include "emic2.h"
- 
-emic2 myTTS(p13, p14); //serial RX,TX pins to emic
- 
+
+emic2 myTTS(p28, p27); //serial RX,TX pins to emic
+
 int main()
 {
     myTTS.volume(18); //max volume
+    string repeat = "Please try again.";
+
+
+
     while(1) {
         myled = 1;
         //Plain text demo
         myTTS.speakf("S");//Speak command starts with "S"
-        myTTS.speakf("Hello. My name is the Emic 2 Text-to-Speech module. I would like to sing you a song on m bed.");  // Send the desired string to convert to speech
+        myTTS.speakf("Welcome to Bat, the Blind Assistive Teacher. This device will help you learn how to write and type braille.");  // Send the desired string to convert to speech
         myTTS.speakf("\r"); //marks end of speak command
         myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
-        myled = 0;
-        myled = 1;
-        //Song Demo
-        myTTS.speakf("D1\r");//Sing Song Demo
-        myTTS.ready(); //member function wait
+        if(str.length(letter[0]) != 0) {
+            myTTS.speakf("STo write the letter %s, press pins %D\r",letter[0], ID);
+            //check pins pressed
+            if(incorrect) {
+                myTTS.speakf("SPin %D is incoorect.\r",ID);
+                myTTS.speakf("S%s.\r", repeat);
+            }
+        } else if(str.length(words) != 0) {
+            myTTS.speakf("SType the word %s.\r",word);
+        }
         myled = 0;
         //Voice Demo
         for (int i=0; i<9 ; i++) { //demo different voices
@@ -34,20 +48,6 @@
             myTTS.speakf("S%D.\r",i);
             myTTS.ready();
         }
-        //Read Time (RTC) demo
-        set_time(1256729737);  // Set RTC time to Wed, 28 Oct 2009 11:35:37
-        wait(2); //let RTC advance two seconds after setting to confirm it works
-        time_t seconds = time(NULL);//read current time
-        myTTS.speakf("STime in seconds since January 1, 1970 =, %d\r", seconds);
-        myTTS.ready();
-        myTTS.speakf("STime as a basic string = %s\r", ctime(&seconds));
-        myTTS.ready();
-        char buffer[32];
-        strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
-        myTTS.speakf("SThe current time is %s\r", buffer);
-        myTTS.ready();
- 
     }
 }
- 
-    
\ No newline at end of file
+