upm  1.3.0
Sensor/Actuator repository for libmraa (v1.7.0)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions
EHR Class Reference

API for the Ear-clip Heart Rate Sensor. More...

Detailed Description

UPM module for the ear-clip heart rate sensor. It is used to measure your heart rate.

// Instantiate a Ear-clip Heart Rate sensor on digital pin D2
upm::EHR* heart = new upm::EHR(2);
// set the beat counter to 0, init the clock and start counting beats
while (shouldRun)
// we grab these just for display purposes in this example
uint32_t millis = heart->getMillis();
uint32_t beats = heart->beatCounter();
// heartRate() requires that at least 5 seconds pass before
// returning anything other than 0
int hr = heart->heartRate();
// output milliseconds passed, beat count, and computed heart rate
cout << "Millis: " << millis << " Beats: " << beats;
cout << " Heart Rate: " << hr << endl;

Public Member Functions

 EHR (int pin)
 ~EHR ()
uint32_t getMillis ()
void initClock ()
void clearBeatCounter ()
void startBeatCounter ()
void stopBeatCounter ()
uint32_t beatCounter ()
int heartRate ()

Constructor & Destructor Documentation

EHR ( int  pin)

EHR constructor

pinDigital pin to use
~EHR ( )

EHR destructor

Member Function Documentation

uint32_t getMillis ( )

Returns the time of milliseconds elapsed since initClock() was last called.

Elapsed milliseconds
void initClock ( )

Resets the clock

void clearBeatCounter ( )

Resets the beat counter to 0. The beat counter should be stopped via stopBeatCounter() prior to calling this function.

void startBeatCounter ( )

Starts the beat counter

void stopBeatCounter ( )

Stops the beat counter

uint32_t beatCounter ( )

Gets the beat Counter

Beat counter
int heartRate ( )

Computes the heart rate

Computed heart rate

The documentation for this class was generated from the following files: