Heart rate sensor example code https://os.mbed.com/users/donalm/code/PulseSensor/

Dependencies:   PulseSensor

main.cpp

Committer:
nprobably
Date:
2017-11-12
Revision:
0:8d3802709c6c

File content as of revision 0:8d3802709c6c:

#include "mbed.h"
#include "PulseSensor.h"
 
Serial pc(USBTX, USBRX);
    
 
/** Print the data in a format that can be parsed by the 
 *  Processing application available here: http://pulsesensor.myshopify.com/pages/code-and-guide
 */
void sendDataToProcessing(char symbol, int data)
{
    if(symbol == 'B') pc.printf("%c%d\r\n", symbol, data);
}
 
 
 
int main() {
    
    PulseSensor sensor(A0, sendDataToProcessing);
 
    pc.baud(115200);
    
    sensor.start();
 
    while(1) {
    }
}