Working read code with mode button

Dependencies:   SDFileSystem emic2 mbed-rtos mbed

Fork of BAT_senior_design_Testnew by BAT

Committer:
aismail1997
Date:
Wed Oct 18 14:41:04 2017 +0000
Revision:
15:b80dde24e9bc
Parent:
12:21268d8bf979
Child:
16:581a3b02f4c3
added comments

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aismail1997 12:21268d8bf979 1 #include "mbed.h"
aismail1997 12:21268d8bf979 2 #include "button.h"
aismail1997 12:21268d8bf979 3
aismail1997 15:b80dde24e9bc 4 // button constructor
aismail1997 12:21268d8bf979 5 button::button(PwmOut servo, DigitalIn pb)
aismail1997 12:21268d8bf979 6 : servo(servo), pb(pb) {}
aismail1997 12:21268d8bf979 7
aismail1997 12:21268d8bf979 8 // FUNCTIONS
aismail1997 15:b80dde24e9bc 9
aismail1997 15:b80dde24e9bc 10 // get servo pin
aismail1997 12:21268d8bf979 11 PwmOut button::getServoPin()
aismail1997 12:21268d8bf979 12 {
aismail1997 12:21268d8bf979 13 return servo;
aismail1997 12:21268d8bf979 14 }
aismail1997 12:21268d8bf979 15
aismail1997 15:b80dde24e9bc 16 // get current state of the button
aismail1997 15:b80dde24e9bc 17 /*int button::getState()
aismail1997 12:21268d8bf979 18 {
aismail1997 12:21268d8bf979 19 return state;
aismail1997 15:b80dde24e9bc 20 }*/
aismail1997 12:21268d8bf979 21
aismail1997 15:b80dde24e9bc 22 // move servo into the slot
aismail1997 12:21268d8bf979 23 void button::moveServoIn()
aismail1997 12:21268d8bf979 24 {
aismail1997 12:21268d8bf979 25 //myled = 1;
aismail1997 12:21268d8bf979 26 // rotate 90 degrees one way
aismail1997 12:21268d8bf979 27 for(int i=3; i<=7; i++) {
aismail1997 12:21268d8bf979 28 servo = i/100.0;
aismail1997 12:21268d8bf979 29 wait(0.01);
aismail1997 12:21268d8bf979 30 }
aismail1997 12:21268d8bf979 31 }
aismail1997 12:21268d8bf979 32
aismail1997 15:b80dde24e9bc 33 // move servo out of the slot
aismail1997 12:21268d8bf979 34 void button::moveServoOut()
aismail1997 12:21268d8bf979 35 {
aismail1997 12:21268d8bf979 36 //myled = 0;
aismail1997 12:21268d8bf979 37 for(int i=7; i>3; i--) {
aismail1997 12:21268d8bf979 38 servo = i/100.0;
aismail1997 12:21268d8bf979 39 wait(0.01);
aismail1997 12:21268d8bf979 40 }
aismail1997 12:21268d8bf979 41 }