A LineFollower library for ASEE-2014

Dependents:   ASEE-2014

Revision:
0:2623af9e8ef3
Child:
1:c319e24af8df
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LineFollower.cpp	Tue Feb 18 04:14:48 2014 +0000
@@ -0,0 +1,44 @@
+#include "LineFollower.h"
+#include "mbed.h"
+#include <stdint.h>
+
+    /** Create a Line Follower interface for an IR Sensor Array
+    *
+    * @param ir1  IR Sensor 1
+    * @param ir2  IR Sensor 2
+    * @param ir3  IR Sensor 3
+    * @param ir4  IR Sensor 4
+    * @param ir5  IR Sensor 5
+    * @param ir6  IR Sensor 6
+    * @param ir7  IR Sensor 7
+    * @param ir8  IR Sensor 8
+    */   
+    LineFollower::Linefollower(DigitalIn ir1, DigitalIn ir2, DigitalIn ir3, DigitalIn ir4,
+                DigitalIn ir5, DigitalIn ir6, DigitalIn ir7, DigitalIn ir8):
+                _ir1(ir1), _ir2(ir2), _ir3(ir3), _ir4(ir4), _ir5(ir5), _ir6(ir6),
+                _ir7(ir7), _ir8(ir8){
+                    
+    }
+                
+                
+    /** Read the value of a LineFollower object
+    * 
+    * @return The value of the Sensor
+    */                    
+    uint8_t LineFollower::read(){
+        uint8_t binary = 0;
+        
+        array[0] = _ir1;
+        array[1] = _ir2;
+        array[2] = _ir3;
+        array[3] = _ir4;
+        array[4] = _ir5;
+        array[5] = _ir6;
+        array[6] = _ir7;
+        array[7] = _ir8;
+        
+        for(int i=0; i<=8; i++){
+               binary += array[i]
+        }
+    
+    }
\ No newline at end of file