Working read code with mode button

Dependencies:   SDFileSystem emic2 mbed-rtos mbed

Fork of BAT_senior_design_Testnew by BAT

button.cpp

Committer:
aismail1997
Date:
2017-10-22
Revision:
16:581a3b02f4c3
Parent:
15:b80dde24e9bc
Child:
21:ceac47be2e64

File content as of revision 16:581a3b02f4c3:

#include "mbed.h"
#include "button.h"

// button constructor
button::button(PwmOut servo, DigitalIn pb)
    : servo(servo), pb(pb) {}
//button::button(PwmOut servo, DigitalIn pb, AnalogIn lp)
//    : servo(servo), pb(pb), linpot(lp), mode(0), state(0) {}

// FUNCTIONS

// get servo pin
PwmOut button::getServoPin()
{
    return servo;
}

// get servo pin
/*void button::setState(int mystate)
{
    state = mystate;
}

// get servo pin
void button::setMode(int mymode)
{
    mode = mymode;
}*/

// get current state of the button
/*int button::getState()
{
    return state;
}*/

// move servo into the slot
void button::moveServoIn()
{
    //myled = 1;
    // rotate 90 degrees one way
    for(int i=3; i<=7; i++) {
        servo = i/100.0;
        wait(0.01);
    }
}

// move servo out of the slot
void button::moveServoOut()
{
    //myled = 0;
    for(int i=7; i>3; i--) {
        servo = i/100.0;
        wait(0.01);
    }
}