Words in Typing mode FINAL
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_Type_word by
Revision 44:9ccc9f8524fd, committed 2017-12-05
- Comitter:
- aismail1997
- Date:
- Tue Dec 05 16:46:37 2017 +0000
- Parent:
- 43:fa8d0db68228
- Commit message:
- works FINAL
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Dec 05 03:34:17 2017 +0000
+++ b/main.cpp Tue Dec 05 16:46:37 2017 +0000
@@ -237,10 +237,10 @@
char wordinput[3];
// replace for loop with submit
// while (!submit) {
- int j = 0;
- int mysubmit = 0;
- while(submit==0) {
- //for (int j = 0; j <= 3; j++) {
+ //int lettercount = 0;
+ //int mysubmit = 0;
+ //while(submit==0) {
+ for (int j = 0; j < 3; j++) {
// check if all buttons were pressed
char* braille;
@@ -250,19 +250,15 @@
sprintf(braille, "%d%d%d%d%d%d", !button1.getPress(), !button2.getPress(),
!button3.getPress(), !button4.getPress(), !button5.getPress(), !button6.getPress());
- //pc.printf("test %s ", braille);
// wait for input
- while ((strcmp(braille, "111111") == 0) && (submit==0)) {
+ while ((strcmp(braille, "111111") == 0)) {
sprintf(braille, "%d%d%d%d%d%d", !button1.getPress(), !button2.getPress(),
!button3.getPress(), !button4.getPress(), !button5.getPress(), !button6.getPress());
}
- if(submit==1) {
+ /*if(submit==1) {
pc.printf("submit\n");
break;
- //mysubmit = 1;
- } /*else {
- pc.printf("submit button not pressed\n");
}*/
// while buttons have not been released
@@ -281,20 +277,32 @@
//pc.printf("%s ", oldbraille);
//if(mysubmit==0) {
userinput = buttonarr.checkVal(oldbraille);
- pc.printf("%c ", userinput);
+ //pc.printf("%c ", userinput);
//wordinput[j] = userinput;
//if(j <= 2) {
wordinput[j] = userinput;
//}
- j++;
- //}
+ //lettercount++;
}
+
+ //char* braille;
+ while (submit == 0) {
+ /*sprintf(braille, "%d%d%d%d%d%d", !button1.getPress(), !button2.getPress(),
+ !button3.getPress(), !button4.getPress(), !button5.getPress(), !button6.getPress());
+ userinput = buttonarr.checkVal(braille);
+ if (userinput != 'Z') {
+ lettercount++;
+ }*/
+ }
+
//pc.printf("submit button pressed\n");
// check result of words
incorrect = 0;
for (int k = 0; k < 3; k++) {
- //pc.printf("%c %c\n", currword[k], wordinput[k]);
+ /*if (lettercount > 3) {
+ incorrect = 1;
+ }*/
if (currword1[k] != wordinput[k]) { // if any letter doesn't match
incorrect = 1; // spelling is wrong
}
@@ -303,10 +311,7 @@
if (incorrect == 1) {
myTTS.speakf("SPlease try again! %s\r", presspin);
myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
- //wait(2);
- //incorrect = 1;
} else {
- //wait(1);
myTTS.speakf("SGood job!\r");
myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
}
