program for final combination of working pieces
Dependencies: SDFileSystem TMP102 mbed ISL29125
Fork of TEMP_Test by
main.cpp@7:6becc29457ce, 2016-03-31 (annotated)
- Committer:
- tdale19
- Date:
- Thu Mar 31 17:32:01 2016 +0000
- Revision:
- 7:6becc29457ce
- Parent:
- 6:61b76e7dc5b7
- Child:
- 8:28f8162d2929
Final Project. With working thermometers and working Solar Panels
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 | 4:4b67d7667474 | 7 | |
Jeriah | 0:547856de255b | 8 | Timer t; |
Jeriah | 2:04c2f253ec87 | 9 | DigitalOut ledBlue(LED_BLUE); |
Jeriah | 2:04c2f253ec87 | 10 | DigitalOut ledRed(LED_RED); |
Jeriah | 2:04c2f253ec87 | 11 | Serial pc(USBTX,USBRX); |
Jeriah | 0:547856de255b | 12 | |
Jeriah | 0:547856de255b | 13 | int main() {//main function, calls other files to move temp,RGB,PV,UV all to one managable function |
Jeriah | 0:547856de255b | 14 | float lastTime = 0; |
Jeriah | 0:547856de255b | 15 | float interval = 0.5; |
Jeriah | 2:04c2f253ec87 | 16 | ledRed = 0; |
Jeriah | 2:04c2f253ec87 | 17 | ledBlue = 1; |
Jeriah | 2:04c2f253ec87 | 18 | wait(0.5); |
Jeriah | 0:547856de255b | 19 | t.start(); |
Jeriah | 2:04c2f253ec87 | 20 | pc.printf("The timer has started\n\r"); |
Jeriah | 2:04c2f253ec87 | 21 | if (mountSDCard()) { |
Jeriah | 0:547856de255b | 22 | return -1; //end program with error status |
Jeriah | 0:547856de255b | 23 | } |
Jeriah | 2:04c2f253ec87 | 24 | pc.printf("The SD card is mounted\n\r"); |
Jeriah | 2:04c2f253ec87 | 25 | ledRed = 1; |
tdale19 | 4:4b67d7667474 | 26 | createDataFile_testTEMP(); |
Jeriah | 2:04c2f253ec87 | 27 | while (t.read()<60) { |
Jeriah | 2:04c2f253ec87 | 28 | if (t.read()>(lastTime+interval)) { |
Jeriah | 0:547856de255b | 29 | lastTime=t.read(); |
tdale19 | 7:6becc29457ce | 30 | pc.printf("temp ouside = %.2f (c) \t inside = %.2f (c) \t on panel = %.2f (c) \t solar volage = %.2f (V) \n\r" ,get_outsideTemp(),get_insideTemp(),get_panelTemp(),get_solar());//prints titles and data of Temp readings |
tdale19 | 7:6becc29457ce | 31 | writeData(lastTime,get_outsideTemp(),get_insideTemp(),get_panelTemp(),get_solar());//send data to writeData in SDsave.cpp |
Jeriah | 0:547856de255b | 32 | //we will get all rgb readings through an array, with the corresponding integers going in order red, green, blue |
Jeriah | 0:547856de255b | 33 | } |
Jeriah | 0:547856de255b | 34 | } |
Jeriah | 0:547856de255b | 35 | closeDataFile(); |
Jeriah | 2:04c2f253ec87 | 36 | ledBlue = 0; |
Jeriah | 2:04c2f253ec87 | 37 | while (true) {}; |
Jeriah | 0:547856de255b | 38 | } |
Jeriah | 0:547856de255b | 39 |