test publish

Dependencies:   mbed GroveEarbudSensor

Committer:
age2pierre
Date:
Thu Mar 24 16:35:09 2016 +0000
Revision:
3:b4f04b8b8797
Parent:
1:4249509c28d1
Child:
5:ee265ab0752d
Changed main for Heart rate example

Who changed what in which revision?

UserRevisionLine numberNew contents of line
antoineA 0:8bec0f0b673a 1 #include "mbed.h"
age2pierre 3:b4f04b8b8797 2 #include "GroveEarbudSensor.h"
antoineA 0:8bec0f0b673a 3
age2pierre 3:b4f04b8b8797 4 InterruptIn earSensor(p5);
age2pierre 3:b4f04b8b8797 5 DigitalOut led(LED1);
age2pierre 3:b4f04b8b8797 6
age2pierre 3:b4f04b8b8797 7 void printHeartRate(float heartrate,void *data) {
age2pierre 3:b4f04b8b8797 8 printf("Callback: heartrate = %.1f\r\n",heartrate);
age2pierre 3:b4f04b8b8797 9 }
antoineA 0:8bec0f0b673a 10
antoineA 0:8bec0f0b673a 11 int main()
antoineA 0:8bec0f0b673a 12 {
age2pierre 3:b4f04b8b8797 13 GroveEarbudSensor earbud(&earSensor);
age2pierre 3:b4f04b8b8797 14 earbud.registerCallback(printHeartRate);
age2pierre 3:b4f04b8b8797 15
age2pierre 3:b4f04b8b8797 16 while(true) {
age2pierre 3:b4f04b8b8797 17 led = !led;
antoineA 1:4249509c28d1 18 wait(0.5);
antoineA 0:8bec0f0b673a 19 }
age2pierre 3:b4f04b8b8797 20
antoineA 0:8bec0f0b673a 21 }