So I wrote a code to assist in obstacle avoidance when I'm driving my robot, but it doesn't work, so I tried a couple of similar codes in a smaller version to find the culprit.
Code #1 below only results in my sensor servo jittering. Code #2 works, but doesn't give me what I need, which is the exact location of the servo so I can know in what direction I'm taking sensor readings in.
After watching the code execute I'm under the impression that the GetServo() returns the position that the servo has been "directed to be in" and not the actual position. Is this correct? If so, then what command am I looking for that will tell me the position it is in so I wont' get the position it is supposed to be in while the servo is still on it's way there.
If the GetServo() does in fact return the exact position the servo is in, then why is my Code#1 below not working when Code #2 does?
Thanks in advance for any assistance.