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-16
Revision:
12:21268d8bf979
Child:
15:b80dde24e9bc

File content as of revision 12:21268d8bf979:

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