Test fork nhi

Dependencies:   SDFileSystem mbed-rtos mbed emic2

Fork of BAT_senior_design by BAT

Committer:
aismail1997
Date:
Wed Nov 29 16:26:22 2017 +0000
Revision:
35:ef0921d9b5bd
Parent:
27:b2e53ce54b3e
word code added (commented out), flipped logic, added reset in the beginning

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aismail1997 10:21268d8bf979 1 #include "mbed.h"
aismail1997 10:21268d8bf979 2
aismail1997 19:ceac47be2e64 3 #ifndef BUTTON_H
aismail1997 19:ceac47be2e64 4 #define BUTTON_H
aismail1997 19:ceac47be2e64 5
aismail1997 13:b80dde24e9bc 6 // This is a button class for our custom button
aismail1997 10:21268d8bf979 7 class button {
aismail1997 10:21268d8bf979 8
aismail1997 13:b80dde24e9bc 9 // pins connected to the button
aismail1997 10:21268d8bf979 10 private:
aismail1997 10:21268d8bf979 11 PwmOut servo;
aismail1997 10:21268d8bf979 12 DigitalIn pb;
aismail1997 19:ceac47be2e64 13 int state; // where is the button (0 - 4)
aismail1997 19:ceac47be2e64 14 int press; // is the button up or down
aismail1997 21:c5df903f068a 15 int id; // this is the ID, each button should have a unique id
aismail1997 13:b80dde24e9bc 16 // int mode; // is the system in reading or typing mode
aismail1997 21:c5df903f068a 17 //AnalogIn linpot;
aismail1997 19:ceac47be2e64 18
aismail1997 10:21268d8bf979 19 public:
aismail1997 10:21268d8bf979 20 // constructors
aismail1997 14:581a3b02f4c3 21 button(); // Default
aismail1997 21:c5df903f068a 22 button(PwmOut servo, DigitalIn pb, int id);
aismail1997 21:c5df903f068a 23 //button(PwmOut servo, DigitalIn pb, AnalogIn linpot);
aismail1997 19:ceac47be2e64 24
aismail1997 14:581a3b02f4c3 25 // button(PwmOut servo, DigitalIn pb, AnalogIn linpot);
aismail1997 10:21268d8bf979 26 // functions
aismail1997 13:b80dde24e9bc 27 PwmOut getServoPin(); // get the servo pin
aismail1997 14:581a3b02f4c3 28 //void setState(int state); // set state
aismail1997 14:581a3b02f4c3 29 //void setMode(int mode); // set mode
aismail1997 21:c5df903f068a 30 void setState(int); // set what state the button is in - up or down
aismail1997 21:c5df903f068a 31 void setPress(int); // set the button press
aismail1997 13:b80dde24e9bc 32 void moveServoIn(); // move servo into the slot
aismail1997 13:b80dde24e9bc 33 void moveServoOut(); // move servo out of the slot
aismail1997 21:c5df903f068a 34 int getID();
aismail1997 19:ceac47be2e64 35 int updateState();
aismail1997 19:ceac47be2e64 36 int getState();
aismail1997 19:ceac47be2e64 37 int getPress();
aismail1997 21:c5df903f068a 38 int getLp();
aismail1997 27:b2e53ce54b3e 39 void setup();
aismail1997 19:ceac47be2e64 40 };
aismail1997 19:ceac47be2e64 41
aismail1997 19:ceac47be2e64 42 #endif