HRV -> Mood

Dependencies:   MAX30101 Hexi_KW40Z Hexi_OLED_SSD1351

Files at this revision

API Documentation at this revision

Comitter:
jeannie9809
Date:
Mon Mar 18 01:03:38 2019 +0000
Parent:
16:8b4f1abd8acc
Child:
18:0d1ef7ea9d4b
Commit message:
better connection

Changed in this revision

8cee5929f4d8/main.cpp Show annotated file Show diff for this revision Revisions of this file
8cee5929f4d8/mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- a/8cee5929f4d8/main.cpp	Sun Mar 17 23:03:21 2019 +0000
+++ b/8cee5929f4d8/main.cpp	Mon Mar 18 01:03:38 2019 +0000
@@ -86,24 +86,23 @@
 {
 
     while (true) {
-        
-        
+        /*
         while(ready_to_send == false) {
             Thread::wait(1000); // wait until has something to send
-                    /*Notify Hexiwear App that it is running Sensor Tag mode*/
-        //kw40z_device.SendSetApplicationMode(GUI_CURRENT_APP_SENSOR_TAG);
         }
-        
-        
+*/
 
-        UpdateSensorData();
-        ready_to_send = false;
-        printf("Sending!");
-
+        if(ready_to_send) {
+            UpdateSensorData();
+            
+            printf("Sending!");
+            kw40z_device.SendBatteryLevel(battery);
+            
+            ready_to_send = false;
+        }
         /*Notify Hexiwear App that it is running Sensor Tag mode*/
         kw40z_device.SendSetApplicationMode(GUI_CURRENT_APP_SENSOR_TAG);
         
-        kw40z_device.SendBatteryLevel(battery);
         
         //send heartrate
 //        kw40z_device.SendHeartRate(testsignal);
@@ -135,18 +134,7 @@
 void UpdateSensorData(void)
 {
 //    testsignal+=1;
-
     battery = valence_arousal;
-    
-    /*
-    if(ready_to_send) {
-        battery = valence_arousal;
-        ready_to_send = false;
-    }
-    else
-        battery = 0;
-    */
-        
     /*battery -= 5;
     if(battery < 5) battery = 100;
 
@@ -477,9 +465,6 @@
             else
                 valence_arousal += 10;
             printf("valence_arousal = %d   ", valence_arousal);
-            while(ready_to_send) {
-                Thread::wait(1000);
-            }
             ready_to_send = true;
         }
         
--- a/8cee5929f4d8/mbed-os.lib	Sun Mar 17 23:03:21 2019 +0000
+++ b/8cee5929f4d8/mbed-os.lib	Mon Mar 18 01:03:38 2019 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#367dbdf5145f4d6aa3e483c147fe7bda1ce23a36
+https://github.com/ARMmbed/mbed-os/#51d55508e8400b60af467005646c4e2164738d48