Trying to separate read/write mode from typing mode

Dependencies:   SDFileSystem emic2 mbed-rtos mbed

Fork of BAT_senior_design_Nhi by BAT

Revision:
33:3090ec93b4aa
Parent:
32:e87bb6e83072
Child:
34:1248dfa0740b
--- a/main.cpp	Mon Nov 20 15:46:11 2017 +0000
+++ b/main.cpp	Wed Nov 29 00:40:16 2017 +0000
@@ -28,7 +28,7 @@
 //DigitalOut led4(LED4);
 
 //DigitalIn linpot(p9);
-//Serial pc(USBTX, USBRX);
+Serial pc(USBTX, USBRX);
 SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card
 //button button1(myservo, pb1, linpot);
 button button1(myservo, pb1, 1);
@@ -61,6 +61,8 @@
 {
     while(true) {
         state = button1.updateState();
+        state6 = button6.updateState();
+
         //led4 = button1.getLp();
         Thread::wait(100); // wait till thread is done
     }
@@ -144,18 +146,7 @@
 
     //led1 = 1;
     //led2 = 1;
-    Thread t1(button_thread);
-    Thread t2(button2_thread);
-    Thread t3(button3_thread);
-    Thread t4(button4_thread);
-    Thread t5(button5_thread);
-    //Thread t6(button6_thread);
-    t1.start(button_thread);
-    t2.start(button2_thread);
-    t3.start(button3_thread);
-    t4.start(button4_thread);
-    t5.start(button5_thread);
-    //t6.start(button6_thread);
+
 
     // PARSE INPUT FILE FOR LETTERS AND WORDS
     char delimiter = ',';
@@ -196,6 +187,19 @@
     }
     fclose(fp); //close file
 
+    Thread t1(button_thread);
+    Thread t2(button2_thread);
+    Thread t3(button3_thread);
+    Thread t4(button4_thread);
+    Thread t5(button5_thread);
+    //Thread t6(button6_thread);
+    t1.start(button_thread);
+    t2.start(button2_thread);
+    t3.start(button3_thread);
+    t4.start(button4_thread);
+    t5.start(button5_thread);
+    //t6.start(button6_thread);
+    
     // start threads for reset, mode, start
     //Thread t1(start_thread);
     //pc.printf("start thread");
@@ -222,11 +226,11 @@
 
     char currletter;
     int lettersize = sizeof(letter)/sizeof(letter[0]);
-    for (int i = 0; i < lettersize; i++) {
+    /*for (int i = 0; i < lettersize; i++) {
         currletter = letter[i][0];
         //pc.printf("currletter %c \n", currletter);
         //pc.printf("braille %s \n", buttonarr.getBraille(currletter));
-    }
+    }*/
 
     /*int* pinsup = buttonarr.pinsUp('M');
     int currpress;
@@ -244,6 +248,7 @@
         currwrong = wrongpins[i];
     }*/
 
+    
     //TEXT-TO-SPEECH LOGIC
     myTTS.volume(18); //max volume
     myTTS.voice(2);
@@ -291,6 +296,8 @@
 
         //WORKS UP TO HERE
         char userinput = buttonarr.checkVal();
+        int test1 = button1.getPress();
+        pc.printf(" %d\n", test1);
         //pc.printf("userinput: %c", userinput);
         // get input
         //pc.printf("Your input was: %c", userinput);