02/07/15

Dependencies:   mbed

Dependents:   TabbedGUIMbed

Committer:
aidanPJG
Date:
Thu Sep 03 15:10:51 2015 +0000
Revision:
70:168d67695a65
Parent:
64:809bd19f4e7c
Child:
71:60f06e7e50a3
commented and working with GUI];

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ADAMSTRUTT 35:085a674c9fdf 1 #include "mbed.h"
ADAMSTRUTT 35:085a674c9fdf 2
ADAMSTRUTT 35:085a674c9fdf 3 LocalFileSystem local("local");
aidanPJG 64:809bd19f4e7c 4 extern Serial pc;
ADAMSTRUTT 35:085a674c9fdf 5
aidanPJG 55:58e9836f5ad1 6 void initialise(int counter )
aidanPJG 43:8e154016dd89 7 {
aidanPJG 70:168d67695a65 8 FILE *fp1 = fopen("/local/Datalog.xls", "a"); // opens or creates fill Datalog,
aidanPJG 70:168d67695a65 9 fprintf(fp1, " Test %d \n", counter); //gives header
aidanPJG 70:168d67695a65 10 fprintf(fp1, " Sensor \t Total Time \t Time Diff \t Inst Speed \t Avg Speed\n"); //writes field names
aidanPJG 70:168d67695a65 11 fclose(fp1); //closes the file so it can be opened by another method
aidanPJG 43:8e154016dd89 12 }
aidanPJG 43:8e154016dd89 13
aidanPJG 64:809bd19f4e7c 14 void data(int sensor_number, double time, double speed, double timesTotal,double speedAvg)
aidanPJG 43:8e154016dd89 15 {
aidanPJG 70:168d67695a65 16 FILE *fp = fopen("/local/Datalog.xls", "a"); // Open "Datalog
aidanPJG 70:168d67695a65 17 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.
aidanPJG 70:168d67695a65 18 fclose(fp); //close
aidanPJG 45:eb06f1d42938 19 }
aidanPJG 45:eb06f1d42938 20
aidanPJG 70:168d67695a65 21 //*********This has not been done yet, but it would be nice to have an average speed for each bend********
aidanPJG 45:eb06f1d42938 22 void averageData() //adds average data fom b2 to b6
aidanPJG 45:eb06f1d42938 23 {
aidanPJG 45:eb06f1d42938 24 FILE *fp2 = fopen("/local/Datalog.xls", "a");
aidanPJG 47:1dc3b5f7bf4a 25 fprintf(fp2, " Average \t=SUM(B2:B4) / 5 \n");
aidanPJG 45:eb06f1d42938 26 fclose(fp2);
ADAMSTRUTT 35:085a674c9fdf 27 }