HRV -> Mood

Dependencies:   MAX30101 Hexi_KW40Z Hexi_OLED_SSD1351

Revision:
6:ff1c3560db84
Parent:
5:a6b6d0e5a69f
Child:
7:7ae14b3b00d1
--- a/8cee5929f4d8/main.cpp	Sat Mar 16 03:46:22 2019 +0000
+++ b/8cee5929f4d8/main.cpp	Sat Mar 16 04:06:37 2019 +0000
@@ -5,6 +5,8 @@
 #include "Hexi_OLED_SSD1351.h"
 #include "Hexi_KW40Z.h"
 #include <math.h>
+#include <vector>
+using namespace std;
 #define FIFO_DATA_MAX 288
 void UpdateSensorData(void);
 void StartHaptic(void);
@@ -199,7 +201,7 @@
                 } else {
 
                     //ppg_single_sample = 65;
-                    //ppg_single_sample = num;
+                    ppg_single_sample = num;
                     if(iter < num_samples)
                         ppg[iter] = num;
 //                    printf("%d\r\n", ppg_single_sample); // I commented this out
@@ -289,7 +291,21 @@
         }
     }
     
-    
+    // extract times that are max
+    int num_max = 0;
+    for(i = 0; i < num_samples; i++) {
+        num_max = max_mult[i];
+    }
+    vector<double> time_of_max;
+    vector<int> index_of_max;
+    vector<int> max_points;
+    for(i = 0; i < num_samples; i++) {
+        if(max_mult[i] == 1) {
+            time_of_max.push_back(TIME[i-1]);
+            index_of_max.push_back(i-1);
+            max_points.push_back(ppg[i-1]);
+        }
+    } 
 }
 
 // main() runs in its own thread in the OS