Working read code with mode button
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_senior_design_Testnew by
button.h@1:f3d363ca2343, 2017-12-04 (annotated)
- Committer:
- nnguyen45
- Date:
- Mon Dec 04 20:14:24 2017 +0000
- Revision:
- 1:f3d363ca2343
- Parent:
- 0:5887cb744114
- Child:
- 43:82d67fb53e61
Updated button array to include almost all letters
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nnguyen45 | 0:5887cb744114 | 1 | #include "mbed.h" |
nnguyen45 | 0:5887cb744114 | 2 | |
nnguyen45 | 0:5887cb744114 | 3 | #ifndef BUTTON_H |
nnguyen45 | 0:5887cb744114 | 4 | #define BUTTON_H |
nnguyen45 | 0:5887cb744114 | 5 | |
nnguyen45 | 0:5887cb744114 | 6 | // This is a button class for our custom button |
nnguyen45 | 0:5887cb744114 | 7 | class button { |
nnguyen45 | 0:5887cb744114 | 8 | |
nnguyen45 | 0:5887cb744114 | 9 | // pins connected to the button |
nnguyen45 | 0:5887cb744114 | 10 | private: |
nnguyen45 | 0:5887cb744114 | 11 | PwmOut servo; |
nnguyen45 | 0:5887cb744114 | 12 | DigitalIn pb; |
nnguyen45 | 0:5887cb744114 | 13 | int state; // where is the button (0 - 4) |
nnguyen45 | 0:5887cb744114 | 14 | int press; // is the button up or down |
nnguyen45 | 0:5887cb744114 | 15 | int id; // this is the ID, each button should have a unique id |
nnguyen45 | 0:5887cb744114 | 16 | |
nnguyen45 | 0:5887cb744114 | 17 | public: |
nnguyen45 | 0:5887cb744114 | 18 | // constructors |
nnguyen45 | 0:5887cb744114 | 19 | button(); // Default |
nnguyen45 | 0:5887cb744114 | 20 | button(PwmOut servo, DigitalIn pb, int id); |
nnguyen45 | 0:5887cb744114 | 21 | |
nnguyen45 | 0:5887cb744114 | 22 | // functions |
nnguyen45 | 0:5887cb744114 | 23 | PwmOut getServoPin(); // get the servo pin |
nnguyen45 | 0:5887cb744114 | 24 | void setState(int); // set what state the button is in - up or down |
nnguyen45 | 0:5887cb744114 | 25 | void setPress(int); // set the button press |
nnguyen45 | 0:5887cb744114 | 26 | void moveServoIn(); // move servo into the slot |
nnguyen45 | 0:5887cb744114 | 27 | void moveServoOut(); // move servo out of the slot |
nnguyen45 | 0:5887cb744114 | 28 | int getID(); |
nnguyen45 | 0:5887cb744114 | 29 | int updateState(); |
nnguyen45 | 0:5887cb744114 | 30 | int getState(); |
nnguyen45 | 0:5887cb744114 | 31 | int getPress(); |
nnguyen45 | 0:5887cb744114 | 32 | int getLp(); |
nnguyen45 | 0:5887cb744114 | 33 | void setup(); |
nnguyen45 | 0:5887cb744114 | 34 | }; |
nnguyen45 | 0:5887cb744114 | 35 | |
nnguyen45 | 0:5887cb744114 | 36 | #endif |