Working read code with mode button
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_senior_design_Testnew by
main.cpp@30:3c4ebc4fde0f, 2017-11-15 (annotated)
- Committer:
- aismail1997
- Date:
- Wed Nov 15 16:27:26 2017 +0000
- Revision:
- 30:3c4ebc4fde0f
- Parent:
- 29:b2e53ce54b3e
- Child:
- 31:b9bd85682db1
pinsUp function works
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aismail1997 | 2:9eda4611081a | 1 | #include "mbed.h" |
aismail1997 | 8:1aa86ad19af9 | 2 | #include "rtos.h" |
aismail1997 | 11:418a4437a693 | 3 | #include "wave_player.h" |
aismail1997 | 11:418a4437a693 | 4 | #include "SDFileSystem.h" |
aismail1997 | 12:21268d8bf979 | 5 | #include "button.h" |
aismail1997 | 21:ceac47be2e64 | 6 | #include "buttonArray.h" |
aismail1997 | 25:23970cf718ee | 7 | #include <string> |
aismail1997 | 25:23970cf718ee | 8 | #include <iostream> |
aismail1997 | 30:3c4ebc4fde0f | 9 | #include "emic2.h" |
aismail1997 | 25:23970cf718ee | 10 | |
aismail1997 | 25:23970cf718ee | 11 | using namespace std; |
aismail1997 | 5:9ed43e974156 | 12 | |
aismail1997 | 15:b80dde24e9bc | 13 | // DEFINE I/O |
aismail1997 | 2:9eda4611081a | 14 | PwmOut myservo(p21); |
aismail1997 | 2:9eda4611081a | 15 | DigitalIn pb1 (p20); |
aismail1997 | 16:581a3b02f4c3 | 16 | PwmOut myservo2(p22); |
aismail1997 | 16:581a3b02f4c3 | 17 | DigitalIn pb2 (p19); |
aismail1997 | 20:d14bf57f435b | 18 | PwmOut myservo3(p23); |
aismail1997 | 20:d14bf57f435b | 19 | DigitalIn pb3 (p18); |
aismail1997 | 20:d14bf57f435b | 20 | PwmOut myservo4(p24); |
aismail1997 | 20:d14bf57f435b | 21 | DigitalIn pb4 (p17); |
aismail1997 | 20:d14bf57f435b | 22 | PwmOut myservo5(p25); |
aismail1997 | 20:d14bf57f435b | 23 | DigitalIn pb5 (p16); |
aismail1997 | 20:d14bf57f435b | 24 | PwmOut myservo6(p26); |
aismail1997 | 20:d14bf57f435b | 25 | DigitalIn pb6 (p15); |
aismail1997 | 20:d14bf57f435b | 26 | |
aismail1997 | 20:d14bf57f435b | 27 | //DigitalOut led1(LED1); |
aismail1997 | 20:d14bf57f435b | 28 | //DigitalOut led3(LED3); |
aismail1997 | 24:6931917c70cd | 29 | //DigitalOut led4(LED4); |
aismail1997 | 16:581a3b02f4c3 | 30 | |
aismail1997 | 24:6931917c70cd | 31 | DigitalIn linpot(p9); |
aismail1997 | 25:23970cf718ee | 32 | Serial pc(USBTX, USBRX); |
aismail1997 | 25:23970cf718ee | 33 | SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card |
aismail1997 | 16:581a3b02f4c3 | 34 | //AnalogOut DACout(p26); |
aismail1997 | 16:581a3b02f4c3 | 35 | //wave_player waver(&DACout); |
aismail1997 | 23:c5df903f068a | 36 | //button button1(myservo, pb1, linpot); |
aismail1997 | 23:c5df903f068a | 37 | button button1(myservo, pb1, 1); |
aismail1997 | 23:c5df903f068a | 38 | button button2(myservo2, pb2, 2); |
aismail1997 | 23:c5df903f068a | 39 | button button3(myservo3, pb3, 3); |
aismail1997 | 23:c5df903f068a | 40 | button button4(myservo4, pb4, 4); |
aismail1997 | 23:c5df903f068a | 41 | button button5(myservo5, pb5, 5); |
aismail1997 | 23:c5df903f068a | 42 | button button6(myservo6, pb6, 6); |
aismail1997 | 6:cc181f8f2bd1 | 43 | |
aismail1997 | 21:ceac47be2e64 | 44 | buttonArray buttonarr(button1, button2, button3, button4, button5, button6); |
aismail1997 | 21:ceac47be2e64 | 45 | |
aismail1997 | 30:3c4ebc4fde0f | 46 | emic2 myTTS(p28, p27); //serial RX,TX pins to emic |
aismail1997 | 30:3c4ebc4fde0f | 47 | |
aismail1997 | 15:b80dde24e9bc | 48 | // INITIALIZE VARIABLES |
aismail1997 | 15:b80dde24e9bc | 49 | // add mode, reset buttons |
aismail1997 | 11:418a4437a693 | 50 | int start = 0; |
aismail1997 | 11:418a4437a693 | 51 | int submit = 0; |
aismail1997 | 20:d14bf57f435b | 52 | // Buttons begins in up state |
aismail1997 | 19:08c575082052 | 53 | int state = 0; |
aismail1997 | 20:d14bf57f435b | 54 | int state2 = 0; |
aismail1997 | 20:d14bf57f435b | 55 | int state3 = 0; |
aismail1997 | 20:d14bf57f435b | 56 | int state4 = 0; |
aismail1997 | 20:d14bf57f435b | 57 | int state5 = 0; |
aismail1997 | 20:d14bf57f435b | 58 | int state6 = 0; |
aismail1997 | 16:581a3b02f4c3 | 59 | int count = 0; |
aismail1997 | 8:1aa86ad19af9 | 60 | |
aismail1997 | 8:1aa86ad19af9 | 61 | // THREADS |
aismail1997 | 15:b80dde24e9bc | 62 | |
aismail1997 | 8:1aa86ad19af9 | 63 | void button_thread() |
aismail1997 | 6:cc181f8f2bd1 | 64 | { |
aismail1997 | 16:581a3b02f4c3 | 65 | while(true) { |
aismail1997 | 21:ceac47be2e64 | 66 | state = button1.updateState(); |
aismail1997 | 23:c5df903f068a | 67 | //led4 = button1.getLp(); |
aismail1997 | 21:ceac47be2e64 | 68 | Thread::wait(100); // wait till thread is done |
aismail1997 | 12:21268d8bf979 | 69 | } |
aismail1997 | 16:581a3b02f4c3 | 70 | } |
aismail1997 | 16:581a3b02f4c3 | 71 | |
aismail1997 | 16:581a3b02f4c3 | 72 | void button2_thread() |
aismail1997 | 16:581a3b02f4c3 | 73 | { |
aismail1997 | 16:581a3b02f4c3 | 74 | while(true) { |
aismail1997 | 21:ceac47be2e64 | 75 | state2 = button2.updateState(); |
aismail1997 | 16:581a3b02f4c3 | 76 | Thread::wait(100); // wait till thread is done |
aismail1997 | 12:21268d8bf979 | 77 | } |
aismail1997 | 6:cc181f8f2bd1 | 78 | } |
aismail1997 | 6:cc181f8f2bd1 | 79 | |
aismail1997 | 20:d14bf57f435b | 80 | // thread for the custom button |
aismail1997 | 20:d14bf57f435b | 81 | void button3_thread() |
aismail1997 | 20:d14bf57f435b | 82 | { |
aismail1997 | 20:d14bf57f435b | 83 | while(true) { |
aismail1997 | 21:ceac47be2e64 | 84 | state3 = button3.updateState(); |
aismail1997 | 21:ceac47be2e64 | 85 | Thread::wait(100); // wait till thread is done |
aismail1997 | 20:d14bf57f435b | 86 | } |
aismail1997 | 20:d14bf57f435b | 87 | } |
aismail1997 | 20:d14bf57f435b | 88 | |
aismail1997 | 20:d14bf57f435b | 89 | // thread for the custom button |
aismail1997 | 20:d14bf57f435b | 90 | void button4_thread() |
aismail1997 | 20:d14bf57f435b | 91 | { |
aismail1997 | 20:d14bf57f435b | 92 | while(true) { |
aismail1997 | 21:ceac47be2e64 | 93 | state4 = button4.updateState(); |
aismail1997 | 21:ceac47be2e64 | 94 | Thread::wait(100); // wait till thread is done |
aismail1997 | 20:d14bf57f435b | 95 | } |
aismail1997 | 20:d14bf57f435b | 96 | } |
aismail1997 | 20:d14bf57f435b | 97 | |
aismail1997 | 20:d14bf57f435b | 98 | // thread for the custom button |
aismail1997 | 20:d14bf57f435b | 99 | void button5_thread() |
aismail1997 | 20:d14bf57f435b | 100 | { |
aismail1997 | 20:d14bf57f435b | 101 | while(true) { |
aismail1997 | 21:ceac47be2e64 | 102 | state5 = button5.updateState(); |
aismail1997 | 21:ceac47be2e64 | 103 | Thread::wait(100); // wait till thread is done |
aismail1997 | 20:d14bf57f435b | 104 | } |
aismail1997 | 20:d14bf57f435b | 105 | } |
aismail1997 | 20:d14bf57f435b | 106 | |
aismail1997 | 20:d14bf57f435b | 107 | // thread for the custom button |
aismail1997 | 20:d14bf57f435b | 108 | void button6_thread() |
aismail1997 | 20:d14bf57f435b | 109 | { |
aismail1997 | 20:d14bf57f435b | 110 | while(true) { |
aismail1997 | 21:ceac47be2e64 | 111 | state6 = button6.updateState(); |
aismail1997 | 21:ceac47be2e64 | 112 | Thread::wait(100); // wait till thread is done |
aismail1997 | 20:d14bf57f435b | 113 | } |
aismail1997 | 20:d14bf57f435b | 114 | } |
aismail1997 | 20:d14bf57f435b | 115 | |
aismail1997 | 8:1aa86ad19af9 | 116 | void submit_thread() |
aismail1997 | 6:cc181f8f2bd1 | 117 | { |
aismail1997 | 15:b80dde24e9bc | 118 | Thread::wait(500); // wait till thread is done |
aismail1997 | 6:cc181f8f2bd1 | 119 | } |
aismail1997 | 6:cc181f8f2bd1 | 120 | |
aismail1997 | 8:1aa86ad19af9 | 121 | void start_thread() |
aismail1997 | 6:cc181f8f2bd1 | 122 | { |
aismail1997 | 8:1aa86ad19af9 | 123 | // read pb_start |
aismail1997 | 8:1aa86ad19af9 | 124 | // if 1 |
aismail1997 | 16:581a3b02f4c3 | 125 | start = 1; |
aismail1997 | 16:581a3b02f4c3 | 126 | //pc.printf("start %d ", start); |
aismail1997 | 8:1aa86ad19af9 | 127 | // else 0 |
aismail1997 | 15:b80dde24e9bc | 128 | Thread::wait(500); // wait till thread is done |
aismail1997 | 6:cc181f8f2bd1 | 129 | } |
aismail1997 | 2:9eda4611081a | 130 | |
aismail1997 | 16:581a3b02f4c3 | 131 | |
aismail1997 | 2:9eda4611081a | 132 | int main() |
aismail1997 | 2:9eda4611081a | 133 | { |
aismail1997 | 29:b2e53ce54b3e | 134 | |
aismail1997 | 25:23970cf718ee | 135 | /* |
aismail1997 | 8:1aa86ad19af9 | 136 | // SETUP |
aismail1997 | 6:cc181f8f2bd1 | 137 | // pull up the pushbutton to prevent bouncing |
aismail1997 | 18:5c91af9b4e7c | 138 | pb1.mode(PullUp); |
aismail1997 | 18:5c91af9b4e7c | 139 | pb2.mode(PullUp); |
aismail1997 | 20:d14bf57f435b | 140 | pb3.mode(PullUp); |
aismail1997 | 20:d14bf57f435b | 141 | pb4.mode(PullUp); |
aismail1997 | 20:d14bf57f435b | 142 | pb5.mode(PullUp); |
aismail1997 | 20:d14bf57f435b | 143 | pb6.mode(PullUp); |
aismail1997 | 29:b2e53ce54b3e | 144 | wait(.001); */ |
aismail1997 | 17:7e9308d14faa | 145 | |
aismail1997 | 24:6931917c70cd | 146 | // servos begin at 30 degrees |
aismail1997 | 12:21268d8bf979 | 147 | // replace with a button setup function |
aismail1997 | 29:b2e53ce54b3e | 148 | buttonarr.setup(); |
aismail1997 | 21:ceac47be2e64 | 149 | |
aismail1997 | 20:d14bf57f435b | 150 | //led1 = 1; |
aismail1997 | 18:5c91af9b4e7c | 151 | //led2 = 1; |
aismail1997 | 25:23970cf718ee | 152 | /*Thread t1(button_thread); |
aismail1997 | 20:d14bf57f435b | 153 | Thread t2(button2_thread); |
aismail1997 | 20:d14bf57f435b | 154 | Thread t3(button3_thread); |
aismail1997 | 20:d14bf57f435b | 155 | Thread t4(button4_thread); |
aismail1997 | 20:d14bf57f435b | 156 | Thread t5(button5_thread); |
aismail1997 | 20:d14bf57f435b | 157 | Thread t6(button6_thread); |
aismail1997 | 20:d14bf57f435b | 158 | t1.start(button_thread); |
aismail1997 | 20:d14bf57f435b | 159 | t2.start(button2_thread); |
aismail1997 | 20:d14bf57f435b | 160 | t3.start(button3_thread); |
aismail1997 | 20:d14bf57f435b | 161 | t4.start(button4_thread); |
aismail1997 | 20:d14bf57f435b | 162 | t5.start(button5_thread); |
aismail1997 | 25:23970cf718ee | 163 | t6.start(button6_thread);*/ |
aismail1997 | 25:23970cf718ee | 164 | |
aismail1997 | 25:23970cf718ee | 165 | // PARSE INPUT FILE FOR LETTERS AND WORDS |
aismail1997 | 25:23970cf718ee | 166 | char delimiter = ','; |
aismail1997 | 25:23970cf718ee | 167 | string letter[2]; |
aismail1997 | 25:23970cf718ee | 168 | string word[2]; |
aismail1997 | 25:23970cf718ee | 169 | char check; |
aismail1997 | 25:23970cf718ee | 170 | string temp; |
aismail1997 | 25:23970cf718ee | 171 | string tempword = ""; |
aismail1997 | 25:23970cf718ee | 172 | int counter = 0; |
aismail1997 | 25:23970cf718ee | 173 | FILE *fp = fopen("/sd/plan.txt", "r"); //create file |
aismail1997 | 25:23970cf718ee | 174 | if(fp == NULL) { |
aismail1997 | 25:23970cf718ee | 175 | pc.printf("Could not open file for write\n"); |
aismail1997 | 25:23970cf718ee | 176 | } |
aismail1997 | 25:23970cf718ee | 177 | check = fgetc(fp); //grabs a char from file |
aismail1997 | 25:23970cf718ee | 178 | while(check != '\n') { //while not at the end of line for letters |
aismail1997 | 25:23970cf718ee | 179 | if((check == delimiter) && (temp.length() == 1)) { //at a comma and have a letter stored |
aismail1997 | 25:23970cf718ee | 180 | letter[counter] = temp; //write letter |
aismail1997 | 25:23970cf718ee | 181 | pc.printf("Letter: %s \n", letter[counter]); |
aismail1997 | 25:23970cf718ee | 182 | counter = counter + 1; //increment counter |
aismail1997 | 25:23970cf718ee | 183 | } else { |
aismail1997 | 25:23970cf718ee | 184 | temp = check; //store letter |
aismail1997 | 25:23970cf718ee | 185 | } |
aismail1997 | 25:23970cf718ee | 186 | check = fgetc(fp); //grabs next char |
aismail1997 | 25:23970cf718ee | 187 | } |
aismail1997 | 25:23970cf718ee | 188 | counter = 0; //reset counter |
aismail1997 | 25:23970cf718ee | 189 | check = fgetc(fp); //grabs next char |
aismail1997 | 25:23970cf718ee | 190 | while(!feof(fp)) { //while not at the end of line for words |
aismail1997 | 25:23970cf718ee | 191 | if(check == delimiter) { //when at the comma at the end of a word |
aismail1997 | 25:23970cf718ee | 192 | word[counter] = tempword; //write word |
aismail1997 | 25:23970cf718ee | 193 | pc.printf("Word: %s \n", word[counter]); |
aismail1997 | 25:23970cf718ee | 194 | tempword = ""; |
aismail1997 | 25:23970cf718ee | 195 | counter = counter + 1; //increment counter |
aismail1997 | 25:23970cf718ee | 196 | } else { |
aismail1997 | 25:23970cf718ee | 197 | tempword = tempword + check; //concatenate letters to build word |
aismail1997 | 25:23970cf718ee | 198 | } |
aismail1997 | 25:23970cf718ee | 199 | check = fgetc(fp); //grabs next char |
aismail1997 | 25:23970cf718ee | 200 | } |
aismail1997 | 25:23970cf718ee | 201 | fclose(fp); //close file |
aismail1997 | 16:581a3b02f4c3 | 202 | |
aismail1997 | 16:581a3b02f4c3 | 203 | // start threads for reset, mode, start |
aismail1997 | 16:581a3b02f4c3 | 204 | //Thread t1(start_thread); |
aismail1997 | 16:581a3b02f4c3 | 205 | //pc.printf("start thread"); |
aismail1997 | 16:581a3b02f4c3 | 206 | //Thread t2(submit_thread); |
aismail1997 | 16:581a3b02f4c3 | 207 | // setup SDcard and Speaker |
aismail1997 | 16:581a3b02f4c3 | 208 | |
aismail1997 | 16:581a3b02f4c3 | 209 | // when started |
aismail1997 | 16:581a3b02f4c3 | 210 | //while (start == 0){} |
aismail1997 | 16:581a3b02f4c3 | 211 | //Thread t3(button_thread); |
aismail1997 | 16:581a3b02f4c3 | 212 | //pc.printf("button thread"); |
aismail1997 | 16:581a3b02f4c3 | 213 | //Thread t4(button2_thread); |
aismail1997 | 16:581a3b02f4c3 | 214 | //pc.printf("button2 thread"); |
aismail1997 | 16:581a3b02f4c3 | 215 | |
aismail1997 | 16:581a3b02f4c3 | 216 | //Thread t3(submit_thread); |
aismail1997 | 16:581a3b02f4c3 | 217 | |
aismail1997 | 16:581a3b02f4c3 | 218 | // when submitted |
aismail1997 | 16:581a3b02f4c3 | 219 | //while (submit == 0) {} |
aismail1997 | 16:581a3b02f4c3 | 220 | |
aismail1997 | 16:581a3b02f4c3 | 221 | // start button threads and submit thread |
aismail1997 | 16:581a3b02f4c3 | 222 | // if submit close button threads and submit thread |
aismail1997 | 16:581a3b02f4c3 | 223 | // check result |
aismail1997 | 16:581a3b02f4c3 | 224 | // play results on speaker |
aismail1997 | 16:581a3b02f4c3 | 225 | // save results |
aismail1997 | 29:b2e53ce54b3e | 226 | |
aismail1997 | 25:23970cf718ee | 227 | char currletter; |
aismail1997 | 25:23970cf718ee | 228 | int lettersize = sizeof(letter)/sizeof(letter[0]); |
aismail1997 | 25:23970cf718ee | 229 | for (int i = 0; i < lettersize; i++) { |
aismail1997 | 25:23970cf718ee | 230 | currletter = letter[i][0]; |
aismail1997 | 25:23970cf718ee | 231 | pc.printf("currletter %c \n", currletter); |
aismail1997 | 25:23970cf718ee | 232 | pc.printf("braille %s \n", buttonarr.getBraille(currletter)); |
aismail1997 | 25:23970cf718ee | 233 | } |
aismail1997 | 29:b2e53ce54b3e | 234 | |
aismail1997 | 25:23970cf718ee | 235 | int* pinsup = buttonarr.pinsUp('M'); |
aismail1997 | 29:b2e53ce54b3e | 236 | int currpress; |
aismail1997 | 29:b2e53ce54b3e | 237 | // get what pins to press |
aismail1997 | 29:b2e53ce54b3e | 238 | for (int i = 1; i <= pinsup[0]; i++) { |
aismail1997 | 29:b2e53ce54b3e | 239 | // speaker stuff |
aismail1997 | 29:b2e53ce54b3e | 240 | currpress = pinsup[i]; |
aismail1997 | 29:b2e53ce54b3e | 241 | } |
aismail1997 | 29:b2e53ce54b3e | 242 | |
aismail1997 | 25:23970cf718ee | 243 | int* wrongpins = buttonarr.wrongPins('M', 'O'); |
aismail1997 | 29:b2e53ce54b3e | 244 | int currwrong; |
aismail1997 | 29:b2e53ce54b3e | 245 | // get what pins are wrong |
aismail1997 | 29:b2e53ce54b3e | 246 | for (int i = 1; i <= wrongpins[0]; i++) { |
aismail1997 | 29:b2e53ce54b3e | 247 | // speaker stuff |
aismail1997 | 29:b2e53ce54b3e | 248 | currwrong = wrongpins[i]; |
aismail1997 | 29:b2e53ce54b3e | 249 | } |
aismail1997 | 30:3c4ebc4fde0f | 250 | |
aismail1997 | 30:3c4ebc4fde0f | 251 | |
aismail1997 | 30:3c4ebc4fde0f | 252 | //TEXT-TO-SPEECH LOGIC |
aismail1997 | 30:3c4ebc4fde0f | 253 | myTTS.volume(18); //max volume |
aismail1997 | 30:3c4ebc4fde0f | 254 | string repeat = "Please try again."; |
aismail1997 | 30:3c4ebc4fde0f | 255 | |
aismail1997 | 30:3c4ebc4fde0f | 256 | 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 |
aismail1997 | 30:3c4ebc4fde0f | 257 | myTTS.ready(); //ready waits for speech to finish from last command with a ":" response |
aismail1997 | 30:3c4ebc4fde0f | 258 | for(int i = 0; i < lettersize; i++) { //iterate through the letter array |
aismail1997 | 30:3c4ebc4fde0f | 259 | int* pinsup = buttonarr.pinsUp('M'); |
aismail1997 | 30:3c4ebc4fde0f | 260 | int currpress; |
aismail1997 | 30:3c4ebc4fde0f | 261 | int numpinsups = pinsup[0]; // size of array is first element of pinsup |
aismail1997 | 30:3c4ebc4fde0f | 262 | //string presspin; |
aismail1997 | 30:3c4ebc4fde0f | 263 | string presspin = "STo write the letter "; |
aismail1997 | 30:3c4ebc4fde0f | 264 | presspin = presspin + letter[i]; |
aismail1997 | 30:3c4ebc4fde0f | 265 | presspin = presspin + ", press pins"; |
aismail1997 | 30:3c4ebc4fde0f | 266 | pc.printf("numpinsups %d", numpinsups); |
aismail1997 | 30:3c4ebc4fde0f | 267 | |
aismail1997 | 30:3c4ebc4fde0f | 268 | for (int j = 1; j < numpinsups; j++) { // get what pins to press |
aismail1997 | 30:3c4ebc4fde0f | 269 | currpress = pinsup[j]; |
aismail1997 | 30:3c4ebc4fde0f | 270 | switch (currpress) { |
aismail1997 | 30:3c4ebc4fde0f | 271 | case 1: |
aismail1997 | 30:3c4ebc4fde0f | 272 | presspin = presspin + " 1,"; |
aismail1997 | 30:3c4ebc4fde0f | 273 | break; |
aismail1997 | 30:3c4ebc4fde0f | 274 | case 2: |
aismail1997 | 30:3c4ebc4fde0f | 275 | presspin = presspin + " 2,"; |
aismail1997 | 30:3c4ebc4fde0f | 276 | break; |
aismail1997 | 30:3c4ebc4fde0f | 277 | case 3: |
aismail1997 | 30:3c4ebc4fde0f | 278 | presspin = presspin + " 3,"; |
aismail1997 | 30:3c4ebc4fde0f | 279 | break; |
aismail1997 | 30:3c4ebc4fde0f | 280 | case 4: |
aismail1997 | 30:3c4ebc4fde0f | 281 | presspin = presspin + " 4,"; |
aismail1997 | 30:3c4ebc4fde0f | 282 | break; |
aismail1997 | 30:3c4ebc4fde0f | 283 | case 5: |
aismail1997 | 30:3c4ebc4fde0f | 284 | presspin = presspin + " 5,"; |
aismail1997 | 30:3c4ebc4fde0f | 285 | break; |
aismail1997 | 30:3c4ebc4fde0f | 286 | case 6: |
aismail1997 | 30:3c4ebc4fde0f | 287 | presspin = presspin + " 6,"; |
aismail1997 | 30:3c4ebc4fde0f | 288 | break; |
aismail1997 | 30:3c4ebc4fde0f | 289 | } |
aismail1997 | 30:3c4ebc4fde0f | 290 | |
aismail1997 | 30:3c4ebc4fde0f | 291 | } |
aismail1997 | 30:3c4ebc4fde0f | 292 | myTTS.speakf("S%s\r",presspin); |
aismail1997 | 30:3c4ebc4fde0f | 293 | |
aismail1997 | 30:3c4ebc4fde0f | 294 | } |
aismail1997 | 30:3c4ebc4fde0f | 295 | //myTTS.speakf("STo write the letter %s, press pins %D\r",letter[i]); |
aismail1997 | 30:3c4ebc4fde0f | 296 | myTTS.ready(); //ready waits for speech to finish from last command with a ":" response |
aismail1997 | 30:3c4ebc4fde0f | 297 | |
aismail1997 | 29:b2e53ce54b3e | 298 | |
aismail1997 | 25:23970cf718ee | 299 | //pc.printf("current braille %c \n", buttonarr.checkVal()); |
aismail1997 | 24:6931917c70cd | 300 | //pc.printf("%c\n", buttonarr.releaseButtons()); |
aismail1997 | 21:ceac47be2e64 | 301 | |
aismail1997 | 8:1aa86ad19af9 | 302 | // MAIN THREAD |
aismail1997 | 8:1aa86ad19af9 | 303 | while(true) { |
aismail1997 | 24:6931917c70cd | 304 | |
aismail1997 | 24:6931917c70cd | 305 | // read linear potentiometer |
aismail1997 | 24:6931917c70cd | 306 | //led4 = linpot; |
aismail1997 | 24:6931917c70cd | 307 | |
aismail1997 | 16:581a3b02f4c3 | 308 | Thread::wait(500); // wait till thread is done |
aismail1997 | 2:9eda4611081a | 309 | } |
aismail1997 | 2:9eda4611081a | 310 | } |