Working read code with mode button
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_senior_design_Testnew by
Diff: buttonArray.cpp
- Revision:
- 36:1248dfa0740b
- Parent:
- 35:3090ec93b4aa
- Child:
- 37:ef0921d9b5bd
- Child:
- 38:593bae6b342b
--- a/buttonArray.cpp Wed Nov 29 00:40:16 2017 +0000 +++ b/buttonArray.cpp Wed Nov 29 15:14:26 2017 +0000 @@ -13,14 +13,14 @@ // map input braille to ascii // braille respresentation here - https://en.wikipedia.org/wiki/Braille_ASCII -char buttonArray::checkVal() +char buttonArray::checkVal(char* braille) { //pc.printf(" checkVal \n"); - char* braille; - char val = NULL; - int test = button1.getPress(); + //char* braille; + char val = 'K'; + /*int test = button1.getPress(); sprintf(braille, "%d%d%d%d%d%d", test, button2.getPress(), - button3.getPress(), button4.getPress(), button5.getPress(), button6.getPress()); + button3.getPress(), button4.getPress(), button5.getPress(), button6.getPress());*/ //pc.printf(" %s \n", braille); if (strcmp(braille, "000000") == 0) val = 'X'; if (strcmp(braille, "011111") == 0) val = 'A'; @@ -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, "010011") == 0) val = 'M'; - if (strcmp(braille, "010101") == 0) val = 'O'; + if (strcmp(braille, "101100") == 0) val = 'M'; + if (strcmp(braille, "101010") == 0) val = 'O'; /*if (strcmp(braille, "011111") == 0) val = 'K'; if (strcmp(braille, "011111") == 0) val = 'L'; if (strcmp(braille, "011111") == 0) val = 'N'; @@ -64,6 +64,7 @@ if (val == 'Z') braille = "111111"; if (val == 'M') braille = "010011"; if (val == 'O') braille = "010101"; + if (val == 'K') braille = "100000"; // check if reset if (val == ' ') braille = "111111"; return braille; @@ -89,11 +90,12 @@ // return feedback on which pins need to be corrected // takes in current and actual char as input and returns status of each char -int* buttonArray::wrongPins(char input, char actual) +int* buttonArray::wrongPins(char* inarr, char actual) { + // TODO check initial value of wrong int* wrong; wrong = new int[7]; - char* inarr = getBraille(input); + //char* inarr = getBraille(input); //pc.printf("input %s\n", inarr); char* actarr = getBraille(actual); //pc.printf("wrong pins");