02/07/15
Dependencies: mbed
Diff: Data.cpp
- Revision:
- 70:168d67695a65
- Parent:
- 64:809bd19f4e7c
- Child:
- 71:60f06e7e50a3
--- a/Data.cpp Thu Aug 27 14:32:20 2015 +0000 +++ b/Data.cpp Thu Sep 03 15:10:51 2015 +0000 @@ -5,20 +5,20 @@ void initialise(int counter ) { - FILE *fp1 = fopen("/local/Datalog.xls", "a"); // opens or creates fill Datalog, and gives the headings - fprintf(fp1, " Test %d \n", counter); - fprintf(fp1, " Sensor \t Total Time \t Time Diff \t Inst Speed \t Avg Speed\n"); - fclose(fp1); + FILE *fp1 = fopen("/local/Datalog.xls", "a"); // opens or creates fill Datalog, + fprintf(fp1, " Test %d \n", counter); //gives header + fprintf(fp1, " Sensor \t Total Time \t Time Diff \t Inst Speed \t Avg Speed\n"); //writes field names + fclose(fp1); //closes the file so it can be opened by another method } void data(int sensor_number, double time, double speed, double timesTotal,double speedAvg) { - // printf("it be printing"); //testing - FILE *fp = fopen("/local/Datalog.xls", "a"); // Open "Datalog - fprintf(fp, " %d \t %lf \t %lf \t %lf \t %lf \n",sensor_number + 1, timesTotal ,time, speed, speedAvg); //fills the tables with the results - fclose(fp); + FILE *fp = fopen("/local/Datalog.xls", "a"); // Open "Datalog + fprintf(fp, " %d \t %lf \t %lf \t %lf \t %lf \n",sensor_number + 1, timesTotal ,time, speed, speedAvg); //fills the tables with the results. sensorNumber +1 because sensor starts at 0. + fclose(fp); //close } +//*********This has not been done yet, but it would be nice to have an average speed for each bend******** void averageData() //adds average data fom b2 to b6 { FILE *fp2 = fopen("/local/Datalog.xls", "a");