Code for Slot Sensor readout. Prints to text file on mbed.

Dependencies:   DebounceIn mbed

Revision:
0:6aa040f8bf2c
Child:
1:b057042a9427
Child:
2:c789547682d8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jul 02 22:31:03 2013 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX); // tx, rx
+
+
+DigitalIn sensor1(p11);
+DigitalIn sensor2(p12);
+
+Timer t;
+Timer timer1;
+Timer timer2;
+
+
+int main()
+{
+    pc.printf("Break sensor to start timer \n \r");
+  
+    while(1) {
+        if (sensor1) { 
+            timer1.start();
+              if (timer1.read_ms()>500) {
+                t.reset();
+                t.start();
+                pc.printf("Start \n \r");
+                timer1.reset();
+            }
+          
+        } // end sensor 1
+        
+
+        if (sensor2) {
+            timer1.reset();
+            timer1.start();
+            if (timer1.read_ms()>500) {
+                t.stop();
+                pc.printf("End. Time taken was %f seconds \n \r", t.read());
+            }
+
+        } // end sensor2
+
+    }
+}