added spectrometer timeout

Dependencies:   SDFileSystem mbed

Fork of All_Combined_Real2 by Colin Maxfield

Revision:
13:346b43aa06c0
Parent:
11:dc884cb71bfa
--- a/main.cpp	Tue Apr 12 18:13:57 2016 +0000
+++ b/main.cpp	Wed Apr 13 23:53:47 2016 +0000
@@ -54,6 +54,7 @@
 
 // Blinking red LED
 DigitalOut led(LED_RED);
+int led_val = 0;
 
 // GPS connection (through arduino)
 Serial duino(PTC4, PTC3);
@@ -133,6 +134,9 @@
 
 int main()
 {
+    led = 1;
+    led_val = 1;
+    
     // turn on light source & spectrometer, start with cooling unit off
     lightsource_ssr = 1;
     spectrometer_ssr = 1;
@@ -158,9 +162,12 @@
 
 
     while (true) {
-
-        led = !led;
-
+        pc.printf("beginning again\r\n");
+        
+        // have to have this extra value b/c it sometimes has problems reading from DigitalOut
+        led = !led_val;
+        led_val = !led_val;
+        pc.printf("about to gps_read\r\n");
         gps_read();
         check_temp();
         // Display result
@@ -175,6 +182,7 @@
         trigger = 0;
         read_pixels();
         
+        pc.printf("%lf\r\n", tempCelsiusDouble);
         if (tempCelsiusDouble > OVERHEATING_TEMP) {
             // Turn off the bulbs and the shutter
             halogen_ttl = 0;
@@ -197,7 +205,8 @@
         } else {
             // turn off cooling
             cooling_ssr = 0;
-        }   
+        }
+        pc.printf("end of cooling\r\n");
         
         wait(0.5f);
     }