Daniel Blomdahl / Mbed 2 deprecated multiple_variable_temp

Dependencies:   MAX31855 SDFileSystem mbed

Files at this revision

API Documentation at this revision

Comitter:
DanielBlomdahl
Date:
Sun May 15 02:32:40 2016 +0000
Parent:
10:f5d4d5e30b9b
Commit message:
Final Publish

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Apr 13 20:26:40 2016 +0000
+++ b/main.cpp	Sun May 15 02:32:40 2016 +0000
@@ -10,16 +10,22 @@
 DigitalOut greenLed(LED2); 
 DigitalOut redLed(LED1);
 
-MAX31855 thermometer1(spi,PTC4);
-MAX31855 thermometer2(spi,PTC3);
+MAX31855 thermometer1(spi,PTB9);
+MAX31855 thermometer2(spi,PTD0);
 AnalogIn solarPanel(PTB2);
 Timer t;
 
 
 int main()
 {
+    const int secondsHalfHour = 30*60; //number of seconds in 1 half hour
+    redLed = 0;
     greenLed = 1;
-    redLed = 0;
+    wait(0.5);
+    redLed = 1;
+    greenLed = 0;
+    wait(0.5);
+    greenLed = 1;
     float temp1, temp2;
     float lastTime = 0;
     float dt = 0.5;
@@ -29,26 +35,31 @@
     t.start();
     mountSDCard();
     openDataFile();
-    while (halfHour<=6) {
+    while (halfHour<6) {
         if (eject == 0) {
             greenLed = 0;
-            redLed = 1;
+            wait(0.5);
+            greenLed = 1;
             break;
         }
-        totalTime = 30*60*halfHour + t.read();
+        totalTime = secondsHalfHour*halfHour + t.read();
         if (totalTime>lastTime+dt) {
             lastTime = totalTime;
             temp1 = thermometer1.read();
             wait(.02);
             temp2 = thermometer2.read();
-            voltage = solarPanel.read(); 
+            voltage = 3.3*(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){
+        if (t.read()>=secondsHalfHour){
             halfHour++;
             t.reset();
         }
     }
     closeDataFile();
+    greenLed = 0;
+    while(true){
+        
+        }
 }
\ No newline at end of file