corazoncito
Revision 0:18957c930b4c, committed 2016-12-03
- Comitter:
- arturogasca
- Date:
- Sat Dec 03 04:25:24 2016 +0000
- Commit message:
- jhj
Changed in this revision
HeartRate.cpp | Show annotated file Show diff for this revision Revisions of this file |
HeartRate.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 18957c930b4c HeartRate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HeartRate.cpp Sat Dec 03 04:25:24 2016 +0000 @@ -0,0 +1,33 @@ +#include "HeartRate.h" + +HeartRate::HeartRate(PinName adc,PinName LO_PLS, PinName LO_MIN) : + sensorPin(adc), + LO_MIN(LO_MIN), + LO_PLS(LO_PLS) +{ +} + +HeartRate::~HeartRate(){ +} + +unsigned short HeartRate::read(){ + + unsigned short value; + value = sensorPin.read_u16(); + + return(value); + +} + +bool HeartRate::available(){ + if(LO_MIN==true || LO_PLS ==true) { + + return(false); + } + else{ + + return(true); + } +} + +
diff -r 000000000000 -r 18957c930b4c HeartRate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HeartRate.h Sat Dec 03 04:25:24 2016 +0000 @@ -0,0 +1,38 @@ +/* HeartRate.h */ +#ifndef HEARTRATE_H_ +#define HEARTRATE_H_ + +#include "mbed.h" + + +/** +*/ + +class HeartRate +{ +public: + /** Constructor + */ + HeartRate(PinName adc, PinName LO_PLS, PinName LO_MIN); + + /** Destructor + */ + ~HeartRate(); + + /** Check available + */ + bool available(); + + /** Read ADC function + */ + unsigned short read(); + +private: + + AnalogIn sensorPin; + DigitalIn LO_MIN; + DigitalIn LO_PLS; + +}; + +#endif /* HEARTRATE_H_ */ \ No newline at end of file