sonar sensor is working in the version of code but the reading are not correct

Dependencies:   C12832 Pulse RangeFinder Servo mbed rtos

Fork of Team_Sprint2 by WIT_EmbOS_Gr1

Revision:
21:32270b453137
Parent:
20:5dfebb54cdbd
Child:
22:5f6df7ae19a3
--- a/main.cpp	Mon Apr 20 13:34:28 2015 +0000
+++ b/main.cpp	Mon Apr 20 14:07:31 2015 +0000
@@ -60,9 +60,9 @@
         differ = ((exp(corVert + sonar * outTilt) / (1 + exp(corVert + sonar * outTilt))) - .49 ) * 2.5;
         if (corVert > 0 && corVert < 1) { // if corVert is valid (between 0 - 1) then do movements                
             // moves lamp down by the fraction of the difference from the middle
-            outVert = (corVert * (1 - differ)) + .5;
+            outVert = (corVert * 2 * (1 - differ));
             // tilt down by the fraction of the difference from the middle
-            outTilt = corVert * differ;
+            outTilt = (corVert * differ) + .15;
         /*} else if (0 < corVert < 0.3) {
             outVert = 0;
             outTilt = corVert * .9; // Follow the low movement only with the tilt servo.