02/07/15

Dependencies:   mbed

Dependents:   TabbedGUIMbed

Revision:
59:2cbbd6fea55b
Parent:
56:bf08d9e50ccc
Child:
61:e7f2a0e38360
--- a/main.cpp	Wed Jul 29 14:10:31 2015 +0000
+++ b/main.cpp	Wed Jul 29 15:27:15 2015 +0000
@@ -7,13 +7,35 @@
 //#include "Counter.h
 
 Serial pc(USBTX, USBRX); // tx, rx 
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+void handshake();
+void run();
 
 int main(void)
 {
-   initialise(3);                                 //used to create the Datalog file should happen once for every bend test
- //  calculate(5,3);    //testing
- 
+    initialise(3);                                 //used to create the Datalog file should happen once for every bend test
+    handshake();      
+    run();
+}
+void handshake()
+{
+            unsigned char input;
+             pc.printf("a\n");
+          
+                 while(true)
+                 {
+                     input = pc.getc();
+                     if (input == 'a')
+                     {
+                         led1 = 1;
+                         run();
+                     }
+                 }
+}
+void run()
+{
     int pins =  inputNoOfPins();                //gets number of pins
     double distance = inputDistance();         //gets the distance between the pins
-    calculate(distance,pins);                  
-}
\ No newline at end of file
+    calculate(distance,pins);    
+}        
\ No newline at end of file