A LineFollower library for ASEE-2014

Dependents:   ASEE-2014

Revision:
0:2623af9e8ef3
Child:
1:c319e24af8df
diff -r 000000000000 -r 2623af9e8ef3 LineFollower.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LineFollower.h	Tue Feb 18 04:14:48 2014 +0000
@@ -0,0 +1,48 @@
+#include "mbed.h"
+#include <stdint.h>
+
+#ifndef MBED_LINEFOLLOWER_H
+#define MBED_LINEFOLLOWER_H
+
+class LineFollower{
+
+    public:
+    /** 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(DigitalIn ir1, DigitalIn ir2, DigitalIn ir3, DigitalIn ir4,
+                DigitalIn ir5, DigitalIn ir6, DigitalIn ir7, DigitalIn ir8);
+                
+                    
+    /** Read the value of a LineFollower object
+    * 
+    * @return The value of the Sensor
+    */                    
+    uint8_t read();
+        
+    protected:
+    
+    #define ROTATE_SPEED    100
+    #define MAXSPEED        200
+    int array[8] {0,0,0,0,0,0,0,0};
+    DigitalIn _ir1;
+    DigitalIn _ir2;
+    DigitalIn _ir3;
+    DigitalIn _ir4;
+    DigitalIn _ir5;
+    DigitalIn _ir6;
+    DigitalIn _ir7;
+    DigitalIn _ir8;
+    
+
+};
+
+#endif
\ No newline at end of file