![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Working read code with mode button
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_senior_design_Testnew by
button.h@23:c5df903f068a, 2017-11-01 (annotated)
- Committer:
- aismail1997
- Date:
- Wed Nov 01 15:22:13 2017 +0000
- Revision:
- 23:c5df903f068a
- Parent:
- 21:ceac47be2e64
- Child:
- 29:b2e53ce54b3e
Updated button and buttonarray classes
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 | 23:c5df903f068a | 15 | int id; // this is the ID, each button should have a unique id |
aismail1997 | 15:b80dde24e9bc | 16 | // int mode; // is the system in reading or typing mode |
aismail1997 | 23:c5df903f068a | 17 | //AnalogIn linpot; |
aismail1997 | 21:ceac47be2e64 | 18 | |
aismail1997 | 12:21268d8bf979 | 19 | public: |
aismail1997 | 12:21268d8bf979 | 20 | // constructors |
aismail1997 | 16:581a3b02f4c3 | 21 | button(); // Default |
aismail1997 | 23:c5df903f068a | 22 | button(PwmOut servo, DigitalIn pb, int id); |
aismail1997 | 23:c5df903f068a | 23 | //button(PwmOut servo, DigitalIn pb, AnalogIn linpot); |
aismail1997 | 21:ceac47be2e64 | 24 | |
aismail1997 | 16:581a3b02f4c3 | 25 | // button(PwmOut servo, DigitalIn pb, AnalogIn linpot); |
aismail1997 | 12:21268d8bf979 | 26 | // functions |
aismail1997 | 15:b80dde24e9bc | 27 | PwmOut getServoPin(); // get the servo pin |
aismail1997 | 16:581a3b02f4c3 | 28 | //void setState(int state); // set state |
aismail1997 | 16:581a3b02f4c3 | 29 | //void setMode(int mode); // set mode |
aismail1997 | 23:c5df903f068a | 30 | void setState(int); // set what state the button is in - up or down |
aismail1997 | 23:c5df903f068a | 31 | void setPress(int); // set the button press |
aismail1997 | 15:b80dde24e9bc | 32 | void moveServoIn(); // move servo into the slot |
aismail1997 | 15:b80dde24e9bc | 33 | void moveServoOut(); // move servo out of the slot |
aismail1997 | 23:c5df903f068a | 34 | int getID(); |
aismail1997 | 21:ceac47be2e64 | 35 | int updateState(); |
aismail1997 | 21:ceac47be2e64 | 36 | int getState(); |
aismail1997 | 21:ceac47be2e64 | 37 | int getPress(); |
aismail1997 | 23:c5df903f068a | 38 | int getLp(); |
aismail1997 | 21:ceac47be2e64 | 39 | }; |
aismail1997 | 21:ceac47be2e64 | 40 | |
aismail1997 | 21:ceac47be2e64 | 41 | #endif |