2014 Eurobot fork

Dependencies:   mbed-rtos mbed QEI

Revision:
84:00c799fd10a7
Parent:
71:eb1956c2d316
Child:
91:fdadfd883825
diff -r 223186cd7531 -r 00c799fd10a7 main.cpp
--- a/main.cpp	Mon Apr 15 22:28:07 2013 +0000
+++ b/main.cpp	Tue Apr 16 10:05:58 2013 +0000
@@ -28,6 +28,13 @@
 void printingtestthread2(void const*);
 void feedbacktest();
 
+DigitalOut *balloon_ptr;
+
+void timeisup_isr(){
+    MotorControl::motorsenabled = 0;
+    *balloon_ptr = 0;
+}
+
 int main()
 {
 
@@ -82,12 +89,22 @@
 
     Thread printingThread(Printing::printingloop, NULL, osPriorityLow, 2048);
     
+    //worry about starting
     DigitalIn startcord(P_START_CORD);
     startcord.mode(PullUp);
     while(!startcord)
         Thread::wait(50);
+        
+    //worry about stopping
+    DigitalOut balloon(P_BALLOON);
+    balloon = 1;
+    balloon_ptr = &balloon;
+    Timeout timeout_90s;
+    timeout_90s.attach(timeisup_isr, 90);
+    
     aithread.signal_set(0x2); //Tell AI thread that its time to go
     
+    
     measureCPUidle(); //repurpose thread for idle measurement
     /*
     MotorControl::set_omegacmd(0);