02/07/15

Dependencies:   mbed

Dependents:   TabbedGUIMbed

Revision:
39:3527578e78dd
Parent:
38:da262dc4f90a
Child:
44:3b45ec49bc44
--- a/Calculate.cpp	Wed Jul 08 10:11:44 2015 +0000
+++ b/Calculate.cpp	Wed Jul 08 10:41:29 2015 +0000
@@ -2,7 +2,7 @@
 #include <time.h>
 #include <string>
 #include <iostream>
-//#include "Distance.h"
+#include "Distance.h"
 
 void printArray(int array[6]);
 
@@ -33,14 +33,13 @@
                 }                                                         //error checking incase next one is done
         }
         sensor_time = time(NULL);                                                //gets current time
-        pc.printf(" %dth sensor: %d \t", i,sensor_time);  
-        pc.printf(" distance is: %f \t", distance); 
+        pc.printf("\n sensor %d : %d \t", i,sensor_time);  
         times[i] = sensor_time;                                                 //adds sensor times to array for logging.
         if ( i > 0) {                                                       //to ensure it is not the first one
              timeDiff  = difftime(times[i], times[i-1]);                    //calculates the time difference
-             pc.printf(" timediff: %d  \t", timeDiff); 
+             pc.printf(" timediff: %d s \t", timeDiff); 
              speed = distance / timeDiff;
-             pc.printf(" speed : %f  \t", speed); 
+             pc.printf(" speed : %f m/s ", speed); 
         }
         i++;
     } 
@@ -53,7 +52,7 @@
       {
         for (int i = 0; i < 5 ; i++)                                     //printing module for array                              
         {
-             pc.printf(" times: %d  \t", times[i]); 
+             pc.printf(" %d : %d  \t", i,times[i]); 
          }
          
       }