Heart rate sensor example code https://os.mbed.com/users/donalm/code/PulseSensor/
Diff: main.cpp
- Revision:
- 0:8d3802709c6c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Nov 12 03:35:57 2017 +0000
@@ -0,0 +1,27 @@
+#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) {
+ }
+}