Interrupt

Dependencies:   BLE_API BLE_Driver I2C_Driver MAX30100 PROCESAMIENTO_DATOS_SP02 mbed nRF51822 millis

Fork of MAX30100_FirstTry by TESIS SATUROMETRICA

Revision:
3:98ca4bf2e74a
Parent:
2:065060bb55f2
Child:
5:c2ce7b743efa
diff -r 065060bb55f2 -r 98ca4bf2e74a mainbletest.cpp
--- a/mainbletest.cpp	Tue Mar 28 02:08:37 2017 +0000
+++ b/mainbletest.cpp	Tue Mar 28 23:16:39 2017 +0000
@@ -29,15 +29,16 @@
 
 int index, aux1, nmuestra;
 
-    char show[10];
+char show[10];
 
 //******************
 
-DigitalOut LIVE_LED(p17, 1);
-DigitalOut CONECT_LED(p18, 1);
-DigitalOut TEST_LED(p19, 1);
-DigitalOut LED(p20, 1);
-DigitalIn TEST_BUTTON(p13,PullUp);
+InterruptIn SMPRDY(p0);
+DigitalOut LIVE_LED(p21, 1);
+DigitalOut CONECT_LED(p22, 1);
+DigitalOut TEST_LED(p23, 1);
+DigitalOut LED(p24, 1);
+//DigitalIn TEST_BUTTON(p17,PullUp);
 
 Ticker Flasher;
 MAX30100 sensor;
@@ -72,16 +73,24 @@
         samples_index++;
         }
 }
+
+void sample(void){
+    LED = 0;
+    sensor.readSensor();
+    sprintf(show, "%d", sensor.IR);
+    putBLE(show);
+    putBLE("\n");
+    }
 int main(void){
+    SMPRDY.fall(&sample);
     Flasher.attach(periodicCallback, 1);
     ini_i2c(SCL, SDA);
     sensor.begin(pw1600, i17, sr50 );
     iniBLE("Sigfried");
     while(1){
-        sensor.readSensor();
-        store_Samples();
-        wait(0.019);
-        
+        //sensor.readSensor();
+        //store_Samples();
+        //wait(0.019);
         }
     }