program for final combination of working pieces

Dependencies:   SDFileSystem TMP102 mbed ISL29125

Fork of TEMP_Test by Thomas Dale

Committer:
tdale19
Date:
Wed Apr 06 05:19:34 2016 +0000
Revision:
10:478e0eb37b0d
Parent:
9:9690da23e8d7
Child:
11:cc9b7a7ce7cf
Updated UV read to match Jeriah's code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tdale19 6:61b76e7dc5b7 1 //Authors: Tom, Nathan, Jeriah
Jeriah 0:547856de255b 2 #include "mbed.h"
tdale19 4:4b67d7667474 3 #include "TEMPSensor.h"
Jeriah 0:547856de255b 4 #include "SDFileSystem.h"
Jeriah 0:547856de255b 5 #include "SDSave.h"
tdale19 7:6becc29457ce 6 #include "SolarPanel.h"
tdale19 8:28f8162d2929 7 #include "UVSensor.h"
tdale19 9:9690da23e8d7 8 #include "RGBSensor.h"
tdale19 4:4b67d7667474 9
Jeriah 0:547856de255b 10 Timer t;
Jeriah 2:04c2f253ec87 11 DigitalOut ledBlue(LED_BLUE);
Jeriah 2:04c2f253ec87 12 DigitalOut ledRed(LED_RED);
Jeriah 2:04c2f253ec87 13 Serial pc(USBTX,USBRX);
Jeriah 0:547856de255b 14
Jeriah 0:547856de255b 15 int main() {//main function, calls other files to move temp,RGB,PV,UV all to one managable function
Jeriah 0:547856de255b 16 float lastTime = 0;
Jeriah 0:547856de255b 17 float interval = 0.5;
Jeriah 2:04c2f253ec87 18 ledRed = 0;
Jeriah 2:04c2f253ec87 19 ledBlue = 1;
Jeriah 2:04c2f253ec87 20 wait(0.5);
Jeriah 0:547856de255b 21 t.start();
Jeriah 2:04c2f253ec87 22 pc.printf("The timer has started\n\r");
Jeriah 2:04c2f253ec87 23 if (mountSDCard()) {
Jeriah 0:547856de255b 24 return -1; //end program with error status
Jeriah 0:547856de255b 25 }
Jeriah 2:04c2f253ec87 26 pc.printf("The SD card is mounted\n\r");
tdale19 9:9690da23e8d7 27
tdale19 9:9690da23e8d7 28 uint16_t rgb[3];
Jeriah 2:04c2f253ec87 29 ledRed = 1;
tdale19 9:9690da23e8d7 30 createDataFile();
Jeriah 2:04c2f253ec87 31 while (t.read()<60) {
Jeriah 2:04c2f253ec87 32 if (t.read()>(lastTime+interval)) {
Jeriah 0:547856de255b 33 lastTime=t.read();
tdale19 10:478e0eb37b0d 34 pc.printf("temp ouside = %.2f (c) \t inside = %.2f (c) \t on panel = %.2f (c) \t solar volage = %.2f (V) \t UV light =%.4f RGB Values: red = %d \t green = %d\t 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
tdale19 9:9690da23e8d7 35 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
tdale19 8:28f8162d2929 36
Jeriah 0:547856de255b 37 }
Jeriah 0:547856de255b 38 }
Jeriah 0:547856de255b 39 closeDataFile();
Jeriah 2:04c2f253ec87 40 ledBlue = 0;
Jeriah 2:04c2f253ec87 41 while (true) {};
Jeriah 0:547856de255b 42 }
Jeriah 0:547856de255b 43