Heart rate sensor example code https://os.mbed.com/users/donalm/code/PulseSensor/
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 #include "PulseSensor.h" 00003 00004 Serial pc(USBTX, USBRX); 00005 00006 00007 /** Print the data in a format that can be parsed by the 00008 * Processing application available here: http://pulsesensor.myshopify.com/pages/code-and-guide 00009 */ 00010 void sendDataToProcessing(char symbol, int data) 00011 { 00012 if(symbol == 'B') pc.printf("%c%d\r\n", symbol, data); 00013 } 00014 00015 00016 00017 int main() { 00018 00019 PulseSensor sensor(A0, sendDataToProcessing); 00020 00021 pc.baud(115200); 00022 00023 sensor.start(); 00024 00025 while(1) { 00026 } 00027 }
Generated on Wed Jul 13 2022 19:22:57 by
1.7.2