![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Fixed wait time
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_senior_design_Nhi by
Diff: buttonArray.cpp
- Revision:
- 21:c5df903f068a
- Parent:
- 20:abbc12fca525
- Child:
- 22:6931917c70cd
--- a/buttonArray.cpp Fri Oct 27 15:18:28 2017 +0000 +++ b/buttonArray.cpp Wed Nov 01 15:22:13 2017 +0000 @@ -4,16 +4,37 @@ // buttonArray constructor buttonArray::buttonArray(button b1, button b2, button b3, button b4, button b5, button b6) : button1(b1), button2(b2), button3(b3), button4(b4), button5(b5), button6(b6) {} - + // FUNCTIONS // map input braille to ascii -int buttonArray::checkVal() { - char* val; - sprintf(val, "%d%d%d%d%d%d", button1.getPress(), button2.getPress(), - button3.getPress(), button4.getPress(), button5.getPress(), button6.getPress()); - if (val == "000000") - return 1; - else - return 0; -} \ No newline at end of file +// braille respresentation here - https://en.wikipedia.org/wiki/Braille_ASCII +char buttonArray::checkVal() +{ + char* input; + char val = NULL; + sprintf(input, "%d%d%d%d%d%d", button1.getPress(), button2.getPress(), + button3.getPress(), button4.getPress(), button5.getPress(), button6.getPress()); + if (strcmp(input, "000000") == 0) val = NULL; + if (strcmp(input, "011111") == 0) val = 'A'; + if (strcmp(input, "001101") == 0) val = 'M'; + if (strcmp(input, "011001") == 0) val = 'O'; + // check if reset + if (strcmp(input, "111111") == 0) val = ' '; + return val; +} + +// return feedback on which pin to correct + + +// release buttons +void buttonArray::releaseButtons() +{ + if (button1.getPress()) { + button1.moveServoOut(); + button1.setState(3); + button1.setPress(0); + } +} +// +