So I was doing some preliminary planning for this project and I was hoping to get some insight. basically instead of just simply calculating distance with the ping I want to calculate the exact position of the object relative to the sensor. basically my plan is this the PING sensor will be mounted on a servo that can move. I will have 4 quadrants of detection with quadrant 1 starting from the left.

basically to pinpoint this object I want to use a while loop

while(ObjectDetectQuad1==True)

{

//Move the Servo 1degree till its no longer true

Degrees++;

}

therefore I will have a relative approximation of the angle at which the object is. So I can use the cosine and sine functions to calculate the X and Y distance. XDist= TotDist*COS(degrees) YDist= TotDist*Sin(degrees). Another dilemma though Im just unsure of where I would put this calculation since I want to calculate it when its just out of ObjectDetectQuad1.