Zhihan Zhang / PulseSensor

Dependents:   4180_FinalProject

Embed: (wiki syntax)

« Back to documentation index

PulseSensor Class Reference

PulseSensor Class Reference

Class for interfacing with a http://pulsesensor.myshopify.com/ 'Pulse Sensor Amped'. More...

#include <PulseSensor.h>

Public Member Functions

 PulseSensor (PinName analogPin, void(*printDataCallback)(int), int callbackRateMs=20)
 PulseSensor Constructor - Note this does not start the reading of the sensor.
 ~PulseSensor ()
 Destructor.
bool start ()
 Start reading the Pulse Sensor, and sending current readings to the print data callback.
bool stop ()
 Stops the current reading of the Pulse Senson.

Detailed Description

Class for interfacing with a http://pulsesensor.myshopify.com/ 'Pulse Sensor Amped'.

The contents of this class are based on the "Pulse Sensor Amped 1.1" Arduino Sketch.

When using this class for the first time, it is recommended that you use the Processing GUI app available http://pulsesensor.myshopify.com/pages/code-and-guide. Using this, you will easily be able to verify the operating of your sensor, and the integration of this class into your mbed project.

Definition at line 17 of file PulseSensor.h.


Constructor & Destructor Documentation

PulseSensor ( PinName  analogPin,
void(*)(int)  printDataCallback,
int  callbackRateMs = 20 
)

PulseSensor Constructor - Note this does not start the reading of the sensor.

Parameters:
analogPinName of the analog pin that the sensor is connected to.
printDataCallbackPointer to function which will be called to print the latest data. Output format available here: http://pulsesensor.myshopify.com/pages/code-and-guide
callbackRateMsRate at which the printDataCallback is to be called, recommended is 20ms for graphing of pulse signal.

Definition at line 4 of file PulseSensor.cpp.

~PulseSensor (  )

Destructor.

Definition at line 16 of file PulseSensor.cpp.


Member Function Documentation

bool start (  )

Start reading the Pulse Sensor, and sending current readings to the print data callback.

Returns:
true if reading of the sensor is started, false if reading was aleady in progress.

Definition at line 110 of file PulseSensor.cpp.

bool stop (  )

Stops the current reading of the Pulse Senson.

Returns:
true if reading is stopped, false if reading was already stopped.

Definition at line 140 of file PulseSensor.cpp.