ECG

Dependents:   BIOMETRICOS_HUMANOS_BETA

Files at this revision

API Documentation at this revision

Comitter:
arturogasca
Date:
Thu Jan 19 20:21:48 2017 +0000
Commit message:
Libreria para sensor ECG;

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 c55e03357261 HeartRate.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeartRate.cpp	Thu Jan 19 20:21:48 2017 +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 c55e03357261 HeartRate.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HeartRate.h	Thu Jan 19 20:21:48 2017 +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