Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem mbed-rtos mbed wave_player emic2
Fork of BAT_senior_design by
Diff: button.cpp
- Revision:
- 10:21268d8bf979
- Child:
- 12:b80dde24e9bc
diff -r 418a4437a693 -r 21268d8bf979 button.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/button.cpp Mon Oct 16 15:45:17 2017 +0000
@@ -0,0 +1,35 @@
+#include "mbed.h"
+#include "button.h"
+
+button::button(PwmOut servo, DigitalIn pb)
+ : servo(servo), pb(pb) {}
+
+// FUNCTIONS
+PwmOut button::getServoPin()
+{
+ return servo;
+}
+
+int button::getState()
+{
+ return state;
+}
+
+void button::moveServoIn()
+{
+ //myled = 1;
+ // rotate 90 degrees one way
+ for(int i=3; i<=7; i++) {
+ servo = i/100.0;
+ wait(0.01);
+ }
+}
+
+void button::moveServoOut()
+{
+ //myled = 0;
+ for(int i=7; i>3; i--) {
+ servo = i/100.0;
+ wait(0.01);
+ }
+}
