program for final combination of working pieces

Dependencies:   SDFileSystem TMP102 mbed ISL29125

Fork of TEMP_Test by Thomas Dale

Committer:
tdale19
Date:
Wed Mar 16 22:06:43 2016 +0000
Revision:
6:61b76e7dc5b7
Parent:
4:4b67d7667474
Child:
7:6becc29457ce
First working Temp test

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"
Jeriah 0:547856de255b 6
Jeriah 1:e0fc716e2394 7
tdale19 4:4b67d7667474 8
Jeriah 0:547856de255b 9 Timer t;
Jeriah 2:04c2f253ec87 10 DigitalOut ledBlue(LED_BLUE);
Jeriah 2:04c2f253ec87 11 DigitalOut ledRed(LED_RED);
Jeriah 2:04c2f253ec87 12 Serial pc(USBTX,USBRX);
Jeriah 0:547856de255b 13
Jeriah 0:547856de255b 14 int main() {//main function, calls other files to move temp,RGB,PV,UV all to one managable function
Jeriah 0:547856de255b 15 float lastTime = 0;
Jeriah 0:547856de255b 16 float interval = 0.5;
Jeriah 2:04c2f253ec87 17 ledRed = 0;
Jeriah 2:04c2f253ec87 18 ledBlue = 1;
Jeriah 2:04c2f253ec87 19 wait(0.5);
Jeriah 0:547856de255b 20 t.start();
Jeriah 2:04c2f253ec87 21 pc.printf("The timer has started\n\r");
Jeriah 2:04c2f253ec87 22 if (mountSDCard()) {
Jeriah 0:547856de255b 23 return -1; //end program with error status
Jeriah 0:547856de255b 24 }
Jeriah 2:04c2f253ec87 25 pc.printf("The SD card is mounted\n\r");
Jeriah 2:04c2f253ec87 26 ledRed = 1;
tdale19 4:4b67d7667474 27 createDataFile_testTEMP();
Jeriah 2:04c2f253ec87 28 while (t.read()<60) {
Jeriah 2:04c2f253ec87 29 if (t.read()>(lastTime+interval)) {
Jeriah 0:547856de255b 30 lastTime=t.read();
tdale19 4:4b67d7667474 31 pc.printf("t = %.2f \t outside = %d \t inside = %d\t panel = %d\r\n",lastTime,get_outsideTemp(),get_insideTemp(),get_panelTemp());//prints titles and data of Temp readings
tdale19 4:4b67d7667474 32 writeData_testTEMP(lastTime,get_outsideTemp(),get_insideTemp(),get_panelTemp());//send data to writeData in SDsave.cpp
Jeriah 0:547856de255b 33 //we will get all rgb readings through an array, with the corresponding integers going in order red, green, blue
Jeriah 0:547856de255b 34 }
Jeriah 0:547856de255b 35 }
Jeriah 0:547856de255b 36 closeDataFile();
Jeriah 2:04c2f253ec87 37 ledBlue = 0;
Jeriah 2:04c2f253ec87 38 while (true) {};
Jeriah 0:547856de255b 39 }
Jeriah 0:547856de255b 40