Roboshark / Mbed 2 deprecated Roboshark_V10

Dependencies:   mbed

Fork of Roboshark_V9 by Roboshark

Revision:
7:862d80e0ea2d
Parent:
6:7bbcdd07bc2d
Child:
9:feabe0b7cea4
--- a/IRSensor.cpp	Thu May 03 19:36:16 2018 +0000
+++ b/IRSensor.cpp	Fri May 04 16:26:59 2018 +0000
@@ -27,9 +27,9 @@
     const float IRSensor :: PF3 = 0.0024f;
     const float IRSensor :: PF4 = -1.3299f;
     const float IRSensor :: PF5 = 351.1557f;
-    const int IRSensor :: minIrR = 100;         // minimal Distanzen
-    const int IRSensor :: minIrL = 100;
-    const int IRSensor :: minIrF = 100;
+    const int IRSensor :: minIrR = 88;         // minimal Distanzen
+    const int IRSensor :: minIrL = 88;
+    const int IRSensor :: minIrF = 79;
     const float IRSensor :: Period = 0.2;       // Ticker Periode
   
     
@@ -57,6 +57,8 @@
         measR = IrRight.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
         measR = measR * 1000; // Change the value to be in the 0 to 1000 range
         disR = PR1*pow(measR,4)+PR2*pow(measR,3)+PR3*pow(measR,2)+PR4*measR+PR5; //disR = f(measR)
+        roundR = disR*100;
+        disR = roundR/100.0-10.0;
         
         return disR;    
 }
@@ -66,6 +68,8 @@
         measL = IrLeft.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
         measL = measL * 1000; // Change the value to be in the 0 to 1000 range
         disL = PL1*pow(measL,4)+PL2*pow(measL,3)+PL3*pow(measL,2)+PL4*measL+PL5; //disL = f(measL)
+        roundL = disL*100;
+        disL = roundL/100.0-10.0;
         
         return disL;    
 }
@@ -75,6 +79,8 @@
         measF = IrFront.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
         measF = measF * 1000; // Change the value to be in the 0 to 1000 range
         disF = PF1*pow(measF,4)+PF2*pow(measF,3)+PF3*pow(measF,2)+PF4*measF+PF5; //disF = f(measF)
+        roundF = disF*100;
+        disF = roundF/100.0-20.0;
         
         return disF;    
 }