added spectrometer timeout

Dependencies:   SDFileSystem mbed

Fork of All_Combined_Real2 by Colin Maxfield

Revision:
11:dc884cb71bfa
Parent:
10:6ecdb63e6698
Child:
13:346b43aa06c0
diff -r 6ecdb63e6698 -r dc884cb71bfa main.cpp
--- a/main.cpp	Mon Apr 11 19:01:23 2016 +0000
+++ b/main.cpp	Tue Apr 12 01:35:06 2016 +0000
@@ -21,6 +21,14 @@
 DigitalOut lightsource_ssr(PTA0);
 DigitalOut cooling_ssr(PTD0);
 
+// Pins for Light Source TTL
+// PTC1  > Halogen Bulb
+// PTB19 > Deuterium Bulb
+// PTB18 > Shutter Control
+DigitalOut halogen_ttl(PTC1);
+DigitalOut deuterium_ttl(PTB19);
+DigitalOut shutter_ttl(PTB18);
+
 // TODO make a new file (name=timestamp) each time we start recording data
 #define OUTPUT_FILE "/sd/data.csv"
 
@@ -130,6 +138,13 @@
     spectrometer_ssr = 1;
     cooling_ssr = 0;
     
+    // Wait a half a second before turning the bulbs on
+    // More code be added to only turn these on if everything seems to be working
+    wait(0.5f);
+    halogen_ttl = 1;
+    deuterium_ttl = 1;
+    shutter_ttl = 1;
+    
     pc.baud(115200); // make sure to set computer TERA Term or whatever to 115200 baud!!!
     duino.baud(9600);
     pc.printf("Initializing ...\r\n");
@@ -161,6 +176,10 @@
         read_pixels();
         
         if (tempCelsiusDouble > OVERHEATING_TEMP) {
+            // Turn off the bulbs and the shutter
+            halogen_ttl = 0;
+            deuterium_ttl = 0;
+            shutter_ttl = 0;
             // turn off light source & spectrometer
             lightsource_ssr = 0;
             spectrometer_ssr = 0;