02/07/15

Dependencies:   mbed

Dependents:   TabbedGUIMbed

Revision:
29:3ef0b7773ff6
Parent:
26:4289549b2d21
diff -r 4289549b2d21 -r 3ef0b7773ff6 Calculate.cpp
--- a/Calculate.cpp	Tue Jul 07 14:52:10 2015 +0000
+++ b/Calculate.cpp	Tue Jul 07 16:00:43 2015 +0000
@@ -4,8 +4,8 @@
 #include <iostream>
  //mbed pins
 extern Serial pc;                                                                   //defines the communication between MBed and pc
-int NoOfPins = 6;                                                                         //for how many sensors there are       
-DigitalIn sensor[6] = {p8,p9,p10,p11,p12,p13};                                                       //array of sensors.   
+//int NoOfPins = 6;                                                                         //for how many sensors there are       
+DigitalIn sensor[6] = {p5,p6,p7,p8,p9,p10};                                                       //array of sensors.   
 //c++ variables
     time_t sensor_time ;                            //time at which sensor is broken
     double timeDifference;                          //time between 2 sensors - not used right now
@@ -16,13 +16,14 @@
     pc.printf("new program \n");                                            //alert user of initialisation   
       
     int i = 0;                                                              //for counter
-    while( i < NoOfPins)                                                    //for every pin
+    while( i < 6)                                                    //for every pin
     {
         while(!sensor[i])                                                   //while not pin. while loop ends after last sensor
         {
-            if(sensor[i + 1]) {                                             //error bypassing measures incase one is missed will continue as normal
+               if(sensor[i + 1]) {                                             //error bypassing measures incase one is missed will continue as normal
                 sensor_time = time(NULL);                                       //get time
-                i++;                                                           //error bypassing incase next one is done
+               // i++;            
+                                                              //error bypassing incase next one is done
                 }                                                         
         }
         sensor_time = time(NULL);                                               //get time