A simple line following program

Dependencies:   mbed

Revision:
3:7f077cf1d755
Parent:
2:f3f0843285e2
Child:
5:c705b7e7e1a8
--- a/main.cpp	Tue Nov 02 16:58:25 2010 +0000
+++ b/main.cpp	Sun Nov 07 10:41:55 2010 +0000
@@ -2,10 +2,11 @@
 #include "m3pi.h"
 
 BusOut leds(LED1,LED2,LED3,LED4);
-m3pi m3pi (p27,p9,p10); //nRST, TX, RX
+m3pi m3pi(p23,p9,p10);
 
 int main() {
 
+
     m3pi.locate(0,1);
     m3pi.printf("Line Flw");
 
@@ -18,26 +19,14 @@
         // -1.0 is far left, 1.0 is far right
         position_of_line = m3pi.line_position();
 
-        // Line is more than 75% to the left
-        if (position_of_line < -0.25) {
-            m3pi.left_motor(speed + 0.3);
-            m3pi.right_motor(speed - 0.3);
-            leds = 0xc;
-        }
         // Line is more than 25% to the left
-        else if (position_of_line < -0.10) {
+        if (position_of_line < -0.50) {
             m3pi.left_motor(speed);
             m3pi.right_motor(speed - 0.3);
             leds = 0x4;
         }
         // Line is more than 75% to the right
-        else if (position_of_line > 0.25) {
-            m3pi.right_motor(speed + 0.3);
-            m3pi.left_motor(speed - 0.3);
-            leds = 0x3;
-        }
-        // Line is more than 75% to the right
-        else if (position_of_line > 0.10) {
+        else if (position_of_line > 0.50) {
             m3pi.right_motor(speed);
             m3pi.left_motor(speed - 0.3);
             leds = 0x2;