This is a repository for code relating to mbed Fitness Tracker

Dependencies:   mbed PulseSensor2 SCP1000 mbed-rtos 4DGL-uLCD-SE LSM9DS1_Library_cal PinDetect FatFileSystemCpp GP-20U7

Files at this revision

API Documentation at this revision

Comitter:
dyu2021
Date:
Mon Apr 20 00:22:18 2020 +0000
Parent:
27:9ad8d9c77f62
Child:
29:b0ccbf3c7b4c
Commit message:
Updated distance and stride_length to feet;

Changed in this revision

maybe_final.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/maybe_final.cpp	Sun Apr 19 23:38:56 2020 +0000
+++ b/maybe_final.cpp	Mon Apr 20 00:22:18 2020 +0000
@@ -221,11 +221,11 @@
             uLCD.media_init();
             uLCD.set_sector_address(0x0000, 0x000F);
             uLCD.display_image(50, 45);
-            uLCD.locate(6, 11);
+            uLCD.locate(5, 11);
             uLCD.text_height(1);
             uLCD.text_width(1);
             uLCD.color(WHITE);
-            uLCD.printf("%4.2f MI", distance);
+            uLCD.printf("%4.0f ft", distance);
             break;
         case 4:
             //Calories
@@ -260,7 +260,7 @@
     //converted weight from lbs to kilograms
     
     //Alternate way to calculate distance (likely more accurate)
-    //distance = distance + (steps - oldSteps)* stride_length /1609.344; //Convert Meters to Miles
+    //distance = distance + (steps - oldSteps)* stride_length;
     //oldSteps = steps;
 }
 
@@ -390,7 +390,7 @@
             if(dif1 > peak_prominence && dif2 > peak_prominence) {
                 steps++;
                 //https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6412957/
-                stride_length = K * pow((double)(max - min), 0.25);
+                stride_length = K * pow((double)(max - min), 0.25) * 3.28084; //feet
                 max = 1.0;
                 min = 1.0;
             }