02/07/15

Dependencies:   mbed

Dependents:   TabbedGUIMbed

Revision:
71:60f06e7e50a3
Parent:
70:168d67695a65
--- a/Calculate.cpp	Thu Sep 03 15:10:51 2015 +0000
+++ b/Calculate.cpp	Thu Sep 03 15:32:01 2015 +0000
@@ -5,9 +5,9 @@
 #include "Data.h"
 
 //*************defining methods used in this method
-void printArray(double array[20], double timesArray[20], int NoOfPins,double speedAvg[20], double timesTotal[20]);                                     
+void printArray(double array[20], double timesArray[20], int NoOfPins,double speedAvg[20], double timesTotal[20], string date);                                     
 void data(int sensor_number, double time, double speed, double timesTotal, double speedAvg);  
-void reset(int distance, int NoOfPins);
+void reset(int distance, int NoOfPins, string date);
                                                 
  //*********mbed pins*********************************
 extern Serial pc;                                                                   //defines the communication between MBed and pc       
@@ -30,7 +30,7 @@
     double totalTimes[20];                             //total runnning times 
    
 
-int calculate(double distance, int NoOfPins)                  //run when the pipe is being bent around the former.
+int calculate(double distance, int NoOfPins, string date)                  //run when the pipe is being bent around the former.
 {     
 while(true)                                                       //keep doing this
 {   
@@ -87,12 +87,12 @@
              } 
         }
         
-         printArray(speeds,times,NoOfPins,avgSpeeds,totalTimes);            //write info to Mbed xl
-        reset(distance, NoOfPins);                                          //reset after all sensors on former have been used. Prepare for it to start from the start again.
+         printArray(speeds,times,NoOfPins,avgSpeeds,totalTimes, date);            //write info to Mbed xl
+        reset(distance, NoOfPins, date);                                          //reset after all sensors on former have been used. Prepare for it to start from the start again.
 }
 }
 
-void reset(int distance, int NoOfPins)                                  //reset after all sensors on former have been used. Prepare for it to start from the start again.     
+void reset(int distance, int NoOfPins, string date)                                  //reset after all sensors on former have been used. Prepare for it to start from the start again.     
 {
     while ( sensor[0]){
         
@@ -114,12 +114,12 @@
          t.reset(); //clock reset
          
          //******start again************
-        calculate(distance, NoOfPins);  //be ready for another bend on same former.
+        calculate(distance, NoOfPins, date);  //be ready for another bend on same former.
 }
 
-void printArray(double array[20], double timesArray[20], int NoOfPins, double speedAvg[20], double timesTotal[20])              //for printing arrays to xl doc on the mbed.
+void printArray(double array[20], double timesArray[20], int NoOfPins, double speedAvg[20], double timesTotal[20], string date)              //for printing arrays to xl doc on the mbed.
       {
-          initialise(bendCounter);                                 //used to create the Datalog file header.Should happen once for every bend test. BendCounter is the iteration of the bend
+          initialise(bendCounter, date);                                 //used to create the Datalog file header.Should happen once for every bend test. BendCounter is the iteration of the bend
          for (int i = 0; i < NoOfPins ; i++)                                 //for every sensor                         
         {
              data( i,times[i],speeds[i],timesTotal[i],speedAvg[i]);            //printing to Datalog