Working read code with mode button
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_senior_design_Testnew by
buttonArray.cpp@21:ceac47be2e64, 2017-10-27 (annotated)
- Committer:
- aismail1997
- Date:
- Fri Oct 27 15:15:00 2017 +0000
- Revision:
- 21:ceac47be2e64
- Child:
- 22:abbc12fca525
cleaned up button code, added buttonarray class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aismail1997 | 21:ceac47be2e64 | 1 | #include "mbed.h" |
aismail1997 | 21:ceac47be2e64 | 2 | #include "buttonArray.h" |
aismail1997 | 21:ceac47be2e64 | 3 | |
aismail1997 | 21:ceac47be2e64 | 4 | // button constructor |
aismail1997 | 21:ceac47be2e64 | 5 | buttonArray::buttonArray(button b1, button b2, button b3, button b4, button b5, button b6) |
aismail1997 | 21:ceac47be2e64 | 6 | : button1(b1), button2(b2), button3(b3), button4(b4), button5(b5), button6(b6) {} |
aismail1997 | 21:ceac47be2e64 | 7 | //button::button(PwmOut servo, DigitalIn pb, AnalogIn lp) |
aismail1997 | 21:ceac47be2e64 | 8 | // : servo(servo), pb(pb), linpot(lp), mode(0), state(0) {} |
aismail1997 | 21:ceac47be2e64 | 9 | |
aismail1997 | 21:ceac47be2e64 | 10 | // FUNCTIONS |
aismail1997 | 21:ceac47be2e64 | 11 | int buttonArray::checkVal() { |
aismail1997 | 21:ceac47be2e64 | 12 | char* val; |
aismail1997 | 21:ceac47be2e64 | 13 | sprintf(val, "%d%d%d%d%d%d", button1.getPress(), button2.getPress(), |
aismail1997 | 21:ceac47be2e64 | 14 | button3.getPress(), button4.getPress(), button5.getPress(), button6.getPress()); |
aismail1997 | 21:ceac47be2e64 | 15 | if (val == "000000") |
aismail1997 | 21:ceac47be2e64 | 16 | return 1; |
aismail1997 | 21:ceac47be2e64 | 17 | else |
aismail1997 | 21:ceac47be2e64 | 18 | return 0; |
aismail1997 | 21:ceac47be2e64 | 19 | } |