program for final combination of working pieces
Dependencies: SDFileSystem TMP102 mbed ISL29125
Fork of TEMP_Test by
SDSave.cpp
- Committer:
- tdale19
- Date:
- 2016-04-06
- Revision:
- 10:478e0eb37b0d
- Parent:
- 9:9690da23e8d7
- Child:
- 13:906a647d7bd1
File content as of revision 10:478e0eb37b0d:
#include "SDFileSystem.h" #include "mbed.h" extern Serial pc; FILE *fp; SDFileSystem fs(PTE3,PTE1,PTE2,PTE4,"fs");//SDFileSystem object void createDataFile() { fp = fopen("/fs/dataLog.txt", "a");// open file and prepare to write if (fp == NULL) { pc.printf("Failed to open the file.\n\r"); } fprintf(fp, "Time (s)\t temperature outside (c)\t inside (c) \t on panel (c) \t Voltage of Panels (V) \t UV (mW/cm2)\t red (mW/cm2)\t green (mW/cm2)\t blue (mW/cm2)\n\r"); } void writeData( float time, float outside, float inside, float panel, float Solar, float UV, uint16_t red, uint16_t green, uint16_t blue) { //output values for each fprintf(fp, "temp ouside = %.2f (c) \t inside = %.2f (c) \t on panel = %.2f (c) \t solar volage = %.2f (V) \t UV light =%.4f \n\r", time, outside, inside, panel, Solar, UV, red, green, blue); } void closeDataFile() { fclose(fp); fs.unmount(); } bool mountSDCard() { bool mountFailure; mountFailure = fs.mount(); return mountFailure; }