working type letter with mode button
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_Type_letter by
Revision 43:9fb92cb259fc, committed 2017-12-05
- Comitter:
- nnguyen45
- Date:
- Tue Dec 05 03:33:11 2017 +0000
- Parent:
- 42:bdb6f132a609
- Commit message:
- working type letter with mode button
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 Mon Dec 04 19:57:53 2017 +0000
+++ b/buttonArray.cpp Tue Dec 05 03:33:11 2017 +0000
@@ -18,31 +18,31 @@
char val = 'K';
if (strcmp(braille, "000000") == 0) val = 'X';
if (strcmp(braille, "011111") == 0) val = 'A';
- //if (strcmp(braille, "001111") == 0) val = 'B';
- //if (strcmp(braille, "011011") == 0) val = 'C';
+ if (strcmp(braille, "001111") == 0) val = 'B';
+ if (strcmp(braille, "011011") == 0) val = 'C';
if (strcmp(braille, "011001") == 0) val = 'D';
- //if (strcmp(braille, "011101") == 0) val = 'E';
- //if (strcmp(braille, "001011") == 0) val = 'F';
- //if (strcmp(braille, "001001") == 0) val = 'G';
- //if (strcmp(braille, "001101") == 0) val = 'H';
- //if (strcmp(braille, "101101") == 0) val = 'I';
- //if (strcmp(braille, "101001") == 0) val = 'J';
- if (strcmp(braille, "010011") == 0) val = 'M';
- if (strcmp(braille, "010101") == 0) val = 'O';
+ if (strcmp(braille, "011101") == 0) val = 'E';
+ if (strcmp(braille, "001011") == 0) val = 'F';
+ if (strcmp(braille, "001001") == 0) val = 'G';
+ if (strcmp(braille, "001101") == 0) val = 'H';
+ if (strcmp(braille, "101011") == 0) val = 'I';
+ if (strcmp(braille, "101001") == 0) val = 'J';
/*if (strcmp(braille, "011111") == 0) val = 'K';
- if (strcmp(braille, "011111") == 0) val = 'L';
- if (strcmp(braille, "011111") == 0) val = 'N';
- if (strcmp(braille, "011111") == 0) val = 'P';
- if (strcmp(braille, "011111") == 0) val = 'Q';
- if (strcmp(braille, "011111") == 0) val = 'R';
- if (strcmp(braille, "011111") == 0) val = 'S';
- if (strcmp(braille, "011111") == 0) val = 'T';
- if (strcmp(braille, "011111") == 0) val = 'U';
- if (strcmp(braille, "011111") == 0) val = 'V';
- if (strcmp(braille, "011111") == 0) val = 'W';
- if (strcmp(braille, "011111") == 0) val = 'X';
- if (strcmp(braille, "011111") == 0) val = 'Y';
- if (strcmp(braille, "011111") == 0) val = 'Z';*/
+ if (strcmp(braille, "000111") == 0) val = 'L';*/
+ if (strcmp(braille, "010011") == 0) val = 'M';
+ if (strcmp(braille, "010001") == 0) val = 'N';
+ if (strcmp(braille, "010101") == 0) val = 'O';
+ /*if (strcmp(braille, "000011") == 0) val = 'P';
+ if (strcmp(braille, "000001") == 0) val = 'Q';
+ if (strcmp(braille, "000101") == 0) val = 'R';
+ if (strcmp(braille, "100011") == 0) val = 'S';
+ if (strcmp(braille, "100001") == 0) val = 'T';
+ if (strcmp(braille, "010110") == 0) val = 'U';
+ if (strcmp(braille, "000110") == 0) val = 'V';
+ if (strcmp(braille, "101000") == 0) val = 'W';
+ if (strcmp(braille, "010010") == 0) val = 'X';
+ if (strcmp(braille, "010000") == 0) val = 'Y';
+ if (strcmp(braille, "010100") == 0) val = 'Z';*/
// check if reset
if (strcmp(braille, "111111") == 0) val = 'Z';
//pc.printf(" %c \n", val);
@@ -53,13 +53,32 @@
char* buttonArray::getBraille(char val)
{
char* braille;
- if (val == 'A') braille = "100000";
- if (val == 'D') braille = "100110";
- if (val == 'X') braille = "000000";
- if (val == 'Z') braille = "111111";
+ if (val == 'A') braille = "011111";
+ if (val == 'B') braille = "001111";
+ if (val == 'C') braille = "011011";
+ if (val == 'D') braille = "011001";
+ if (val == 'E') braille = "011101";
+ if (val == 'F') braille = "001011";
+ if (val == 'G') braille = "001001";
+ if (val == 'H') braille = "001101";
+ if (val == 'I') braille = "101011";
+ if (val == 'J') braille = "101001";
+ /*if (val == 'K') braille = "011111";
+ if (val == 'L') braille = "000111";*/
if (val == 'M') braille = "010011";
+ if (val == 'N') braille = "010001";
if (val == 'O') braille = "010101";
- if (val == 'K') braille = "100000";
+ /*if (val == 'P') braille = "000011";
+ if (val == 'Q') braille = "000001";
+ if (val == 'R') braille = "000101";
+ if (val == 'S') braille = "100011";
+ if (val == 'T') braille = "100001";
+ if (val == 'U') braille = "010110";
+ if (val == 'V') braille = "000110";
+ if (val == 'W') braille = "101000";
+ if (val == 'X') braille = "010010";
+ if (val == 'Y') braille = "010000";
+ if (val == 'Z') braille = "010100";*/
// check if reset
if (val == ' ') braille = "111111";
return braille;
--- a/main.cpp Mon Dec 04 19:57:53 2017 +0000
+++ b/main.cpp Tue Dec 05 03:33:11 2017 +0000
@@ -22,6 +22,7 @@
DigitalIn pb5 (p16);
PwmOut myservo6(p26);
DigitalIn pb6 (p15);
+DigitalIn read (p29);
//DigitalOut led1(LED1);
//DigitalOut led3(LED3);
@@ -116,6 +117,7 @@
pb4.mode(PullUp);
pb5.mode(PullUp);
pb6.mode(PullUp);
+ read.mode(PullUp);
wait(.001);
// PARSE INPUT FILE FOR LETTERS AND WORDS
@@ -173,7 +175,7 @@
//int type = 0;
//TEXT-TO-SPEECH LOGIC
- myTTS.volume(3); //max volume is 18
+ myTTS.volume(18); //max volume is 18
myTTS.voice(2);
@@ -192,13 +194,15 @@
// check if correct letter
// feedback
// loop
-
+ myTTS.speakf("SPlease switch the device into typing mode.\r"); // Send the desired string to convert to speech
+ myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
+ while(read==1) {}
for(int i = 0; i < lettersize; i++) { //iterate through the letter array
char currletter = letter[i][0];
int* pinsup = buttonarr.pinsUp(currletter);
int currpress;
int numpinsups = pinsup[0]; // size of array is first element of pinsup
- string presspin = "STo write the letter ";
+ string presspin = "STo type the letter ";
presspin = presspin + letter[i];
presspin = presspin + ", press buttons";
@@ -322,8 +326,9 @@
myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
}
}
-
}
+ myTTS.speakf("SThis is the end of the module.\r"); // Send the desired string to convert to speech
+ myTTS.ready(); //ready waits for speech to finish from last command with a ":" response
// MAIN THREAD
while(true) {
