Sample program illustrating the use of the GroveEarbudSensor library

Dependencies:   GroveEarbudSensor mbed

Files at this revision

API Documentation at this revision

Comitter:
sam_grove
Date:
Wed Oct 01 21:35:54 2014 +0000
Parent:
4:df7309612854
Commit message:
update example

Changed in this revision

BufferedSerial.lib Show diff for this revision Revisions of this file
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
diff -r df7309612854 -r f1b55ff3cda0 BufferedSerial.lib
--- a/BufferedSerial.lib	Fri Sep 26 02:39:13 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/sam_grove/code/BufferedSerial/#8287e83943f0
diff -r df7309612854 -r f1b55ff3cda0 GroveEarbudSensor.lib
--- a/GroveEarbudSensor.lib	Fri Sep 26 02:39:13 2014 +0000
+++ b/GroveEarbudSensor.lib	Wed Oct 01 21:35:54 2014 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/ansond/code/GroveEarbudSensor/#56720730382d
+http://developer.mbed.org/users/ansond/code/GroveEarbudSensor/#06be613d8c3e
diff -r df7309612854 -r f1b55ff3cda0 main.cpp
--- a/main.cpp	Fri Sep 26 02:39:13 2014 +0000
+++ b/main.cpp	Wed Oct 01 21:35:54 2014 +0000
@@ -20,10 +20,6 @@
 
 #include "mbed.h"
 
-// Console
-#include "BufferedSerial.h"
-BufferedSerial pc(USBTX,USBRX);
-
 // Blinky
 DigitalOut led(LED1);
 
@@ -35,30 +31,30 @@
 
 // callback for receiving heartrate values
 void heartrateCallback(float heartrate,void *data) {
-    pc.printf("Callback: heartrate = %.1f\r\n",heartrate);
+    printf("Callback: heartrate = %.1f\r\n",heartrate);
 }
 
 int main()
 {   
     // announce
-    pc.printf("Grove Earbud Sensor Example v1.0.0\r\n");
+    printf("Grove Earbud Sensor Example v1.0.0\r\n");
     
     // allocate the earbud sensor
-    pc.printf("Allocating earbud sensor instance...\r\n");
+    printf("Allocating earbud sensor instance...\r\n");
     GroveEarbudSensor earbud(&sensor); 
     
     // register our callback function
-    pc.printf("registering callback...\r\n");
+    printf("registering callback...\r\n");
     earbud.registerCallback(heartrateCallback);
     
     // begin main loop
-    pc.printf("Beginning main loop...\r\n");
+    printf("Beginning main loop...\r\n");
     while (true) {
         // blink... 
         led = !led; 
         wait(0.5);
         
         // we can also call directly 
-        //pc.printf("Direct: heartrate = %.1f\r\n",earbud.getHeartRate());
+        //printf("Direct: heartrate = %.1f\r\n",earbud.getHeartRate());
     }
 }
\ No newline at end of file