testing forking

Dependencies:   mbed

Fork of ConsolTest by Pipeline Technology Centre

Revision:
4:e61cd14ec4f0
Parent:
3:1ef4740c5a64
Child:
7:d6f78ba7c5f7
diff -r 1ef4740c5a64 -r e61cd14ec4f0 main.cpp
--- a/main.cpp	Wed Jul 01 09:55:47 2015 +0000
+++ b/main.cpp	Wed Jul 01 11:02:10 2015 +0000
@@ -1,25 +1,33 @@
 #include "mbed.h"
+#include <time.h>
+#include <string>
+#include <iostream>
  
-Serial pc(USBTX, USBRX); // tx, rx
-DigitalIn input(p8);
-DigitalOut led(LED1);
- 
+Serial pc(USBTX, USBRX); // tx, rx                                          //defines the communication between MBed and pc
+DigitalIn input(p8);                                                        //input from diode. Digital 1 is beam unbroken?
+DigitalOut led(LED1);                                                       //testing purposes 
+
+
 int main() {
-    pc.printf("new program \n");
-     
-    while(1) {
-        if (input)
+    int line = 0;                                                           //line counter
+    pc.printf("new program \n");                                            //lert user of initialisation  
+      
+    while(1) {                                                              //loops continuously 
+        if (input)                                                          //checks the digital input from the diode.
         {
-            pc.printf("digital in = 1 \n");
+            pc.printf("Message  %d : \t", line);
+            pc.printf("DigitalIn: 1 \n");   
             led = 1;
-          //  wait(0);
+            line = line + 1;
+         
         }
        else
        {
-                pc.printf("digital in = 0 \n");
+                pc.printf("Message %d : \t", line);
+                pc.printf("DigitalIn 0\n");              
                 led = 0;
-             //   wait(0);
-                led = 0;
+                line = line + 1   ;        
+              
         }
     }
 }
\ No newline at end of file