Test fork nhi

Dependencies:   SDFileSystem mbed-rtos mbed emic2

Fork of BAT_senior_design by BAT

button.cpp

Committer:
aismail1997
Date:
2017-10-18
Revision:
13:b80dde24e9bc
Parent:
10:21268d8bf979
Child:
14:581a3b02f4c3

File content as of revision 13:b80dde24e9bc:

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

// button constructor
button::button(PwmOut servo, DigitalIn pb)
    : servo(servo), pb(pb) {}

// FUNCTIONS

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

// 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);
    }
}