working type letter with mode button
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_Type_letter by
Revision 36:593bae6b342b, committed 2017-11-30
- Comitter:
- nnguyen45
- Date:
- Thu Nov 30 22:07:00 2017 +0000
- Parent:
- 34:1248dfa0740b
- Child:
- 37:d873136dfb12
- Commit message:
- Working reset, flipped logic
Changed in this revision
| buttonArray.cpp | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/buttonArray.cpp Wed Nov 29 15:14:26 2017 +0000
+++ b/buttonArray.cpp Thu Nov 30 22:07:00 2017 +0000
@@ -33,8 +33,8 @@
if (strcmp(braille, "001101") == 0) val = 'H';
if (strcmp(braille, "101101") == 0) val = 'I';
if (strcmp(braille, "101001") == 0) val = 'J';
- if (strcmp(braille, "101100") == 0) val = 'M';
- if (strcmp(braille, "101010") == 0) val = 'O';
+ if (strcmp(braille, "010011") == 0) val = 'M';
+ if (strcmp(braille, "010101") == 0) val = 'O';
/*if (strcmp(braille, "011111") == 0) val = 'K';
if (strcmp(braille, "011111") == 0) val = 'L';
if (strcmp(braille, "011111") == 0) val = 'N';
@@ -95,8 +95,6 @@
// TODO check initial value of wrong
int* wrong;
wrong = new int[7];
- //char* inarr = getBraille(input);
- //pc.printf("input %s\n", inarr);
char* actarr = getBraille(actual);
//pc.printf("wrong pins");
int j = 1;
--- a/main.cpp Wed Nov 29 15:14:26 2017 +0000
+++ b/main.cpp Thu Nov 30 22:07:00 2017 +0000
@@ -255,6 +255,27 @@
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
+ char* braille;
+ char userinput;
+
+ // INITIAL RESET
+ int reset = 1;
+ myTTS.speakf("SPlease setup the device by pressing down all the buttons.\r");
+ myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
+ while(reset == 1) {
+ wait(2);
+ 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') {
+ reset = 0;
+ } else {
+ //reset = 0;
+ myTTS.speakf("SSetup failed. Please try again.\r");
+ myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
+ }
+ }
+
for(int i = 0; i < lettersize; i++) { //iterate through the letter array
char currletter = letter[i][0];
//pc.printf("letter: %c \n", currletter);
