![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
02/07/15
Dependencies: mbed
Data.cpp@45:eb06f1d42938, 2015-07-09 (annotated)
- Committer:
- aidanPJG
- Date:
- Thu Jul 09 13:34:13 2015 +0000
- Revision:
- 45:eb06f1d42938
- Parent:
- 44:3b45ec49bc44
- Child:
- 46:70031ad8f2b9
Added averageData() method that adds the average speed to the end of the xl file
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ADAMSTRUTT | 35:085a674c9fdf | 1 | #include "mbed.h" |
ADAMSTRUTT | 35:085a674c9fdf | 2 | |
ADAMSTRUTT | 35:085a674c9fdf | 3 | LocalFileSystem local("local"); |
ADAMSTRUTT | 35:085a674c9fdf | 4 | |
aidanPJG | 43:8e154016dd89 | 5 | void initialise() |
aidanPJG | 43:8e154016dd89 | 6 | { |
aidanPJG | 43:8e154016dd89 | 7 | FILE *fp1 = fopen("/local/Datalog.xls", "a"); // opens or creates fill Datalog, and gives the headings |
aidanPJG | 44:3b45ec49bc44 | 8 | fprintf(fp1, " Sensor Name \t Speed \n"); |
aidanPJG | 43:8e154016dd89 | 9 | fclose(fp1); |
aidanPJG | 43:8e154016dd89 | 10 | } |
aidanPJG | 43:8e154016dd89 | 11 | |
aidanPJG | 43:8e154016dd89 | 12 | void data(int sensor_number, int speed) |
aidanPJG | 43:8e154016dd89 | 13 | { |
aidanPJG | 44:3b45ec49bc44 | 14 | printf("it be printing"); //testing |
aidanPJG | 43:8e154016dd89 | 15 | FILE *fp = fopen("/local/Datalog.xls", "a"); // Open "Datalog |
aidanPJG | 43:8e154016dd89 | 16 | fprintf(fp, " %d \t %d \n",sensor_number, speed); //fills the tables with the results |
ADAMSTRUTT | 35:085a674c9fdf | 17 | fclose(fp); |
aidanPJG | 45:eb06f1d42938 | 18 | } |
aidanPJG | 45:eb06f1d42938 | 19 | |
aidanPJG | 45:eb06f1d42938 | 20 | void averageData() //adds average data fom b2 to b6 |
aidanPJG | 45:eb06f1d42938 | 21 | { |
aidanPJG | 45:eb06f1d42938 | 22 | FILE *fp2 = fopen("/local/Datalog.xls", "a"); |
aidanPJG | 45:eb06f1d42938 | 23 | fprintf(fp2, " %Average \t=SUM(B2:B6) / 5 \n"); |
aidanPJG | 45:eb06f1d42938 | 24 | fclose(fp2); |
ADAMSTRUTT | 35:085a674c9fdf | 25 | } |