program for final combination of working pieces
Dependencies: SDFileSystem TMP102 mbed ISL29125
Fork of TEMP_Test by
main.cpp
- Committer:
- tdale19
- Date:
- 2016-04-06
- Revision:
- 11:cc9b7a7ce7cf
- Parent:
- 10:478e0eb37b0d
- Child:
- 12:7ed53be0057a
File content as of revision 11:cc9b7a7ce7cf:
//Authors: Tom, Nathan, Jeriah #include "mbed.h" #include "TEMPSensor.h" #include "SDFileSystem.h" #include "SDSave.h" #include "SolarPanel.h" #include "UVSensor.h" #include "RGBSensor.h" Timer t; DigitalOut ledBlue(LED_BLUE); DigitalOut ledRed(LED_RED); Serial pc(USBTX,USBRX); int main() {//main function, calls other files to move temp,RGB,PV,UV all to one managable function float lastTime = 0; float interval = 0.5; ledRed = 0; ledBlue = 1; wait(0.5); t.start(); pc.printf("The timer has started\n\r"); if (mountSDCard()) { return -1; //end program with error status } pc.printf("The SD card is mounted\n\r"); uint16_t rgb[3]; ledRed = 1; createDataFile(); while (t.read()<60) { if (t.read()>(lastTime+interval)) { lastTime=t.read(); get_rgb(rgb); pc.printf("temp ouside = %.2f (c) inside = %.2f (c) on panel = %.2f (c) solar volage = %.2f (V) UV light =%.4f RGB Values: red = %d green = %d blue = %d\r\n" ,get_outsideTemp(),get_insideTemp(),get_panelTemp(),get_solar(),(get_UV()),rgb[0],rgb[1],rgb[2]);//prints titles and data of Temp readings writeData(lastTime,get_outsideTemp(),get_insideTemp(),get_panelTemp(),get_solar(),get_UV(),rgb[0],rgb[1],rgb[2]);//send data to writeData in SDsave.cpp } } closeDataFile(); ledBlue = 0; while (true) {}; }