![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Fixed wait time
Dependencies: SDFileSystem emic2 mbed-rtos mbed
Fork of BAT_senior_design_Nhi by
Diff: button.cpp
- Revision:
- 10:21268d8bf979
- Child:
- 13:b80dde24e9bc
--- /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); + } +}