Working read code with mode button

Dependencies:   SDFileSystem emic2 mbed-rtos mbed

Fork of BAT_senior_design_Testnew by BAT

Revision:
27:0ed2a9cad0e1
Parent:
26:4b2940eec275
--- a/main.cpp	Fri Nov 10 16:48:26 2017 +0000
+++ b/main.cpp	Wed Nov 15 16:09:16 2017 +0000
@@ -7,6 +7,7 @@
 #include <string>
 #include <iostream>
 #include "emic2.h"
+#include <stdio.h>
 
 using namespace std;
 
@@ -271,27 +272,50 @@
     myTTS.volume(18); //max volume
     string repeat = "Please try again.";
 
-    myTTS.speakf("SWelcome to Bat, the Blind Assistive Teacher. This device will help you learn how to write and type braille.\r");  // Send the desired string to convert to speech
+    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
-    for(int i = 0; i < letter.length(); i++) {  //iterate through the letter array
+    for(int i = 0; i < lettersize; i++) {  //iterate through the letter array
         int* pinsup = buttonarr.pinsUp('M');
         int currpress;
-        int numpinsups = pinsup[0];
-        string presspin = "STo write the letter %s, press pins ";
-        sprintf(presspin, letter[i]):
+        int numpinsups = pinsup[0];  // size of array is first element of pinsup
+        //string presspin;
+        string presspin = "STo write the letter ";
+        presspin = presspin + letter[i];
+        presspin = presspin + ", press pins";
+        pc.printf("numpinsups %d", numpinsups);
 
-            for (int i = 1; i <= numpinsups; i++) {  // get what pins to press
-            currpress = pinsup[i];
-            presspin = presspin + to_string(currpress) + " ";
+        for (int j = 1; j <= numpinsups; j++) {  // get what pins to press
+            currpress = pinsup[j];
+            switch (currpress) {
+                case 1:
+                    presspin = presspin + " 1";
+                    break;
+                case 2:
+                    presspin = presspin + " 2";
+                    break;
+                case 3:
+                    presspin = presspin + " 3";
+                    break;
+                case 4:
+                    presspin = presspin + " 4";
+                    break;
+                case 5:
+                    presspin = presspin + " 5";
+                    break;
+                case 6:
+                    presspin = presspin + " 6";
+                    break;
+            }
 
         }
         myTTS.speakf("S%s\r",presspin);
 
     }
-    myTTS.speakf("STo write the letter %s, press pins %D\r",letter[i]);
+    //myTTS.speakf("STo write the letter %s, press pins %D\r",letter[i]);
     myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
 
-    //check pins pressed
+/*
+//check pins pressed
     if(incorrect) {
         myTTS.speakf("SPin %D is incoorect.\r",ID);
         myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
@@ -311,7 +335,7 @@
         myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
     }
 }
-
+*/