IT GOES NORTH MOST OF THE TIME

Dependencies:   HMC6352 Motor mbed

Revision:
3:4ee5247f47ec
Parent:
1:6812f830e5a1
Child:
4:9011798d1a20
--- a/main.cpp	Thu Oct 04 19:11:02 2012 +0000
+++ b/main.cpp	Thu Oct 04 20:45:34 2012 +0000
@@ -15,9 +15,9 @@
     
     printf("Front Right Left\n\r");
     int i=0;
-    int readLeftVals[10];
-    int readRightVals[10];
-    int readFrontVals[10];
+    float readLeftVals[10];
+    float readRightVals[10];
+    float readFrontVals[10];
     float readLeft;
     float readRight;
     float readFront;
@@ -26,13 +26,13 @@
     for (int j=0; j<10; j++);
     {
         readLeft=irLeft;
-        readLeft=10/readLeft;
+        readLeft=21/readLeft;
         
         readRight=irRight;
-        readRight=10/readRight;
+        readRight=21/readRight;
         
         readFront=irFront;
-        readFront=10/readFront;
+        readFront=21/readFront;
         
         readFrontVals[i] = readFront;
         readRightVals[i] = readRight;
@@ -41,18 +41,18 @@
     
     while (1){
         readLeft=irLeft;
-        readLeft=10/readLeft;
+        readLeft=21/readLeft;
         
         readRight=irRight;
-        readRight=10/readRight;
+        readRight=21/readRight;
         
         readFront=irFront;
-        readFront=10/readFront;
+        readFront=21/readFront;
         
         
        
         
-        if (i>10)
+        if (i>=10)
         {
             i=0;
         }
@@ -61,7 +61,7 @@
         readLeftVals[i] = readLeft;
         i++;
         
-        int avgFront = 0, avgRight = 0, avgLeft = 0;
+        float avgFront = 0, avgRight = 0, avgLeft = 0;
         
         for (int j=0; j<10; j++)
         {