LOO C++ project

Dependencies:   mbed text_to_speak_mbed GroveEarbudSensor

Files at this revision

API Documentation at this revision

Comitter:
EnSoka
Date:
Sun Dec 23 19:51:55 2018 +0000
Commit message:
Project LOO c++

Changed in this revision

GroveEarbudSensor.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
text_to_speak_mbed.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 213bf9be9e9e GroveEarbudSensor.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/GroveEarbudSensor.lib	Sun Dec 23 19:51:55 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/ansond/code/GroveEarbudSensor/#8687d42d6798
diff -r 000000000000 -r 213bf9be9e9e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Dec 23 19:51:55 2018 +0000
@@ -0,0 +1,68 @@
+
+#include "mbed.h"
+
+// Blinky
+DigitalOut led(LED1);
+
+Serial pc(p9, p10); // tx, rx
+
+// Our sensor as an InterruptIn
+InterruptIn sensor(D0);
+
+// Grove Earbud Sensor include
+#include "GroveEarbudSensor.h"
+
+// callback for receiving heartrate values
+void heartrateCallback(float heartrate,void *data) {
+    printf("Callback: heartrate = %.1f\r\n",heartrate);
+}
+
+int main()
+{  
+/* 
+    // announce
+    printf("Grove Earbud Sensor Example v1.0.0\r\n");
+    
+    // allocate the earbud sensor
+    printf("Allocating earbud sensor instance...\r\n");
+    GroveEarbudSensor earbud(&sensor); 
+    
+    // register our callback function
+    printf("registering callback...\r\n");
+    earbud.registerCallback(heartrateCallback);
+    
+    // begin main loop
+    printf("Beginning main loop...\r\n");
+    while (true) {
+        // blink... 
+        led = !led; 
+        wait(0.5);
+        
+        // we can also call directly 
+        //printf("Direct: heartrate = %.1f\r\n",earbud.getHeartRate());
+    }*/
+       /* pc.baud(19200);
+        pc.printf("Hello World\n");*/
+        
+        // announce
+    printf("Grove Earbud Sensor Example v1.0.0\r\n");
+    
+    // allocate the earbud sensor
+    printf("Allocating earbud sensor instance...\r\n");
+    GroveEarbudSensor earbud(&sensor); 
+    
+    // register our callback function
+    printf("registering callback...\r\n");
+    earbud.registerCallback(heartrateCallback);
+    
+    // begin main loop
+    printf("Beginning main loop...\r\n");
+    while (true) {
+        // blink... 
+        led = !led; 
+        wait(0.5);
+        
+        // we can also call directly 
+        //printf("Direct: heartrate = %.1f\r\n",earbud.getHeartRate());
+    }
+}
diff -r 000000000000 -r 213bf9be9e9e mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Dec 23 19:51:55 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file
diff -r 000000000000 -r 213bf9be9e9e text_to_speak_mbed.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/text_to_speak_mbed.lib	Sun Dec 23 19:51:55 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/daveyclk/code/text_to_speak_mbed/#b33a6418e125