![](/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
main.cpp@8:28f8162d2929, 2016-03-31 (annotated)
- Committer:
- tdale19
- Date:
- Thu Mar 31 17:53:11 2016 +0000
- Revision:
- 8:28f8162d2929
- Parent:
- 7:6becc29457ce
- Child:
- 9:9690da23e8d7
Program now works for UV as well
Who changed what in which revision?
User | Revision | Line number | New 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 | 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 | 8:28f8162d2929 | 31 | pc.printf("temp ouside = %.2f (c) \t inside = %.2f (c) \t on panel = %.2f (c) \t solar volage = %.2f (V) \t UV light =%.2f \n\r" ,get_outsideTemp(),get_insideTemp(),get_panelTemp(),get_solar(),get_UV());//prints titles and data of Temp readings |
tdale19 | 8:28f8162d2929 | 32 | writeData(lastTime,get_outsideTemp(),get_insideTemp(),get_panelTemp(),get_solar(),get_UV());//send data to writeData in SDsave.cpp |
tdale19 | 8:28f8162d2929 | 33 | |
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 |