Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MAX31855 SDFileSystem mbed
Diff: main.cpp
- Revision:
- 10:f5d4d5e30b9b
- Parent:
- 9:c97cd10b11ac
- Child:
- 11:1e56b710b568
--- a/main.cpp Wed Apr 13 20:14:37 2016 +0000
+++ b/main.cpp Wed Apr 13 20:26:40 2016 +0000
@@ -18,41 +18,37 @@
int main()
{
- greenLed = 1;
- redLed = 0;
- float temp1, temp2;
- float lastTime = 0;
- float dt = 0.5;
- float voltage = 0;
- float halfHour = 0;
- t.start();
- mountSDCard();
- openDataFile();
- float timeReset = 0;
- while (halfHour<=6) {
- if (eject == 0) {
- greenLed = 0;
- redLed = 1;
- break;
- }
-
- else if (t.read()>lastTime+dt) {
- lastTime = t.read();
- timeReset = 30*60*halfHour+lastTime;
+ greenLed = 1;
+ redLed = 0;
+ float temp1, temp2;
+ float lastTime = 0;
+ float dt = 0.5;
+ float voltage = 0;
+ float halfHour = 0;
+ float totalTime;
+ t.start();
+ mountSDCard();
+ openDataFile();
+ while (halfHour<=6) {
+ if (eject == 0) {
+ greenLed = 0;
+ redLed = 1;
+ break;
+ }
+ totalTime = 30*60*halfHour + t.read();
+ if (totalTime>lastTime+dt) {
+ lastTime = totalTime;
temp1 = thermometer1.read();
wait(.02);
temp2 = thermometer2.read();
voltage = solarPanel.read();
pc.printf("Voltage %f\t Temp1 %f\t Temp2 %f\t Time %f\r\n", voltage, temp1, temp2, lastTime);
-
writeData(lastTime, temp1, temp2, voltage);
- if (t.read()>=30*60){
- halfHour++;
- t.reset();
- }
}
-
-
- }
- closeDataFile();
+ if (t.read()>=30*60){
+ halfHour++;
+ t.reset();
+ }
+ }
+ closeDataFile();
}
\ No newline at end of file
