Test fork nhi
Dependencies: SDFileSystem mbed-rtos mbed emic2
Fork of BAT_senior_design by
Diff: button.cpp
- Revision:
- 21:c5df903f068a
- Parent:
- 19:ceac47be2e64
- Child:
- 22:6931917c70cd
--- a/button.cpp Fri Oct 27 15:18:28 2017 +0000
+++ b/button.cpp Wed Nov 01 15:22:13 2017 +0000
@@ -2,10 +2,11 @@
#include "button.h"
// button constructor
-button::button(PwmOut servo, DigitalIn pb)
- : servo(servo), pb(pb), press(0), state(0) {}
-//button::button(PwmOut servo, DigitalIn pb, AnalogIn lp)
-// : servo(servo), pb(pb), linpot(lp), mode(0), state(0) {}
+button::button(PwmOut servo, DigitalIn pb, int id)
+ : servo(servo), pb(pb), state(0), press(0), id(id){}
+/*button::button(PwmOut servo, DigitalIn pb, AnalogIn lp)
+ : servo(servo), pb(pb), linpot(lp), press(0), state(0) {}
+*/
// FUNCTIONS
@@ -21,6 +22,11 @@
state = mystate;
}
+void button::setPress(int mypress)
+{
+ press = mypress;
+}
+
// get servo pin
/*void button::setMode(int mymode)
{
@@ -33,11 +39,25 @@
return state;
}
+int button::getID()
+{
+ return id;
+}
+
+
int button::getPress()
{
return press;
}
+// get current state of the button
+int button::getLp()
+{
+/* if (linpot < 2)
+ return 1;
+ else*/
+ return 0;
+}
// move servo into the slot
void button::moveServoIn()
