![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
program for final combination of working pieces
Dependencies: SDFileSystem TMP102 mbed ISL29125
Fork of TEMP_Test by
Diff: SDSave.cpp
- Revision:
- 2:04c2f253ec87
- Parent:
- 1:e0fc716e2394
- Child:
- 4:4b67d7667474
diff -r e0fc716e2394 -r 04c2f253ec87 SDSave.cpp --- a/SDSave.cpp Sat Mar 12 00:01:03 2016 +0000 +++ b/SDSave.cpp Sat Mar 12 01:40:42 2016 +0000 @@ -1,7 +1,7 @@ #include "SDFileSystem.h" #include "mbed.h" -Serial pc(USBTX, USBRX); +extern Serial pc; FILE *fp; SDFileSystem fs(PTE3,PTE1,PTE2,PTE4,"fs");//SDFileSystem object @@ -10,7 +10,7 @@ if (fp == NULL) { pc.printf("Failed to open the file.\n\r"); } - fprintf(fp, "Time (s)\t temperature (c)\t UV (mW/cm2)\t red (mW/cm2)\t green (mW/cm2)\t blue (mW/cm2)"); + fprintf(fp, "Time (s)\t temperature (c)\t UV (mW/cm2)\t red (mW/cm2)\t green (mW/cm2)\t blue (mW/cm2)\n\r"); } void createDataFile_testRGB() { @@ -18,24 +18,23 @@ if (fp == NULL) { pc.printf("Failed to open the file.\n\r"); } - fprintf(fp, "Time (s)\t red (mW/cm2)\t green (mW/cm2)\t blue (mW/cm2)"); + fprintf(fp, "Time (s)\t red (mW/cm2)\t green (mW/cm2)\t blue (mW/cm2)\n\r"); } + void writeData(float time, float temp, float uv, uint16_t red, uint16_t green, uint16_t blue) { fprintf(fp, "%.2f \t %.2f \t %.2f \t %d \t %d \t %d\n\r", time, temp, uv, red, green, blue); } void writeData_testRGB(float time, uint16_t red, uint16_t green, uint16_t blue) { - //output values for each fprintf(fp, "%.2f \t %d \t %d \t %d\n\r", time, red, green, blue); } -bool mountFailure(){ - if (fs.mount() !=0) - return false;//if mount has been accomplished return false - else - return true; +bool mountSDCard() { + bool mountFailure; + mountFailure = fs.mount(); + return mountFailure; } void closeDataFile() {