Oscar Schofield / Mbed 2 deprecated Elec350_OBS

Dependencies:   mbed

button.cpp

Committer:
Oschofield
Date:
2015-11-10
Revision:
8:ad8e2dd314a2
Parent:
7:1e9cd1481e80
Child:
9:a018d7c05dc7

File content as of revision 8:ad8e2dd314a2:

#include "button.h" //header file included


Button::Button(string s){
    if (s == "user"){
        pin = new DigitalIn(PA_0);
    }
}

bool Button::ifPressed(){
    return *pin;
}

float getPulse(){
    while(button.isPressed()== false{
        //DO NADA    
    }

    Timer timer;
    timer.start();
    
    while(button.isPressed()== true{
        wait(0.01f);
    }
    timer.stop();
    return timer.read();    
}