added spectrometer timeout

Dependencies:   SDFileSystem mbed

Fork of All_Combined_Real2 by Colin Maxfield

Revision:
3:c611fff05072
Parent:
2:146625d6992d
Child:
4:70411c8dadcc
diff -r 146625d6992d -r c611fff05072 main.cpp
--- a/main.cpp	Tue Mar 15 17:48:34 2016 +0000
+++ b/main.cpp	Tue Mar 15 17:52:05 2016 +0000
@@ -2,6 +2,7 @@
 #include "nmea.h"
 #include "SDFileSystem.h"
 #include "SPI.h"
+#include "temp_sensor.h"
 
 #define NUM_PIXELS 2048
 #define BUF_SIZE 1024
@@ -103,6 +104,8 @@
     fifo_cs = 1;
     trigger = 0;
     wait(0.5f);
+    
+    init_temp_sensor(); // TODO: stop execution & send error message if can't init temp sensor (or other things)
 
 
     while (true) {
@@ -110,6 +113,13 @@
         led = !led;
 
         gps_read();
+        
+        check_temp();
+        // Display result
+        pc.printf(",%s", TempCelsiusDisplay);
+        fpData = fopen(OUTPUT_FILE, "a");
+        fprintf(fpData, ",%s", TempCelsiusDisplay);
+        fclose(fpData);
 
         // Trigger an acquisition from spectrometer
         trigger = 1;