My first robot

I don't have the logic for the code quite sorted out in my head yet so if anyone has any advice, I welcome it!

The Ping sensor gives (indirectly) the distance to the nearest object. Turn the head 90 degrees, and take a reading.(distanceR). Then, rotate the head back to front, and then rotate 90 degrees the other way, and take another reading (distanceL).

Turn left or right based on whether distanceR or distanceL is greater.

Of course, you not limited to 90 degree head turns or robot turns. You could read 45 degrees on either side of straight ahead, and turn 45 degrees.