Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Data.cpp
- Committer:
- aidanPJG
- Date:
- 2015-09-03
- Revision:
- 71:60f06e7e50a3
- Parent:
- 70:168d67695a65
File content as of revision 71:60f06e7e50a3:
#include "mbed.h" #include <string> LocalFileSystem local("local"); extern Serial pc; void initialise(int counter, string date ) { FILE *fp1 = fopen("/local/Datalog.xls", "a"); // opens or creates fill Datalog, fprintf(fp1, " Test %d \n %s \n", counter, date); //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) { 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"); fprintf(fp2, " Average \t=SUM(B2:B4) / 5 \n"); fclose(fp2); }