Code for Sprint 2
Dependencies: C12832 mbed rtos RangeFinder
Diff: main.cpp
- Revision:
- 19:32270b453137
- Parent:
- 18:5dfebb54cdbd
- Child:
- 20:5f6df7ae19a3
diff -r 5dfebb54cdbd -r 32270b453137 main.cpp --- 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.