Working read code with mode button
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_senior_design_Testnew by
button.h@21:ceac47be2e64, 2017-10-27 (annotated)
- Committer:
- aismail1997
- Date:
- Fri Oct 27 15:15:00 2017 +0000
- Revision:
- 21:ceac47be2e64
- Parent:
- 16:581a3b02f4c3
- Child:
- 23:c5df903f068a
cleaned up button code, added buttonarray class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aismail1997 | 12:21268d8bf979 | 1 | #include "mbed.h" |
aismail1997 | 12:21268d8bf979 | 2 | |
aismail1997 | 21:ceac47be2e64 | 3 | #ifndef BUTTON_H |
aismail1997 | 21:ceac47be2e64 | 4 | #define BUTTON_H |
aismail1997 | 21:ceac47be2e64 | 5 | |
aismail1997 | 15:b80dde24e9bc | 6 | // This is a button class for our custom button |
aismail1997 | 12:21268d8bf979 | 7 | class button { |
aismail1997 | 12:21268d8bf979 | 8 | |
aismail1997 | 15:b80dde24e9bc | 9 | // pins connected to the button |
aismail1997 | 12:21268d8bf979 | 10 | private: |
aismail1997 | 12:21268d8bf979 | 11 | PwmOut servo; |
aismail1997 | 12:21268d8bf979 | 12 | DigitalIn pb; |
aismail1997 | 21:ceac47be2e64 | 13 | int state; // where is the button (0 - 4) |
aismail1997 | 21:ceac47be2e64 | 14 | int press; // is the button up or down |
aismail1997 | 15:b80dde24e9bc | 15 | // int mode; // is the system in reading or typing mode |
aismail1997 | 16:581a3b02f4c3 | 16 | // AnalogIn linpot; |
aismail1997 | 21:ceac47be2e64 | 17 | |
aismail1997 | 12:21268d8bf979 | 18 | public: |
aismail1997 | 12:21268d8bf979 | 19 | // constructors |
aismail1997 | 16:581a3b02f4c3 | 20 | button(); // Default |
aismail1997 | 12:21268d8bf979 | 21 | button(PwmOut servo, DigitalIn pb); |
aismail1997 | 21:ceac47be2e64 | 22 | |
aismail1997 | 16:581a3b02f4c3 | 23 | // button(PwmOut servo, DigitalIn pb, AnalogIn linpot); |
aismail1997 | 12:21268d8bf979 | 24 | // functions |
aismail1997 | 15:b80dde24e9bc | 25 | PwmOut getServoPin(); // get the servo pin |
aismail1997 | 16:581a3b02f4c3 | 26 | //void setState(int state); // set state |
aismail1997 | 16:581a3b02f4c3 | 27 | //void setMode(int mode); // set mode |
aismail1997 | 21:ceac47be2e64 | 28 | void setState(int); // determine what state the button is in - up or down |
aismail1997 | 15:b80dde24e9bc | 29 | void moveServoIn(); // move servo into the slot |
aismail1997 | 15:b80dde24e9bc | 30 | void moveServoOut(); // move servo out of the slot |
aismail1997 | 21:ceac47be2e64 | 31 | int updateState(); |
aismail1997 | 21:ceac47be2e64 | 32 | int getState(); |
aismail1997 | 21:ceac47be2e64 | 33 | int getPress(); |
aismail1997 | 21:ceac47be2e64 | 34 | }; |
aismail1997 | 21:ceac47be2e64 | 35 | |
aismail1997 | 21:ceac47be2e64 | 36 | #endif |