After Mark pointed out the problems of using a Ping with the S2, I tried adding my MaxBotix LV-EZ0 ultrasound sensor to the S2.
I found the weakness with the ultrasound was its inability to see our couch. I changed the original program to keep track of how long it had been since the previous obstacle so if the robot encountered the same obstacle twice it would head off in the opposite direction.
I posted my very first YouTube video of the robot avoiding a few obstacles. (I'm going to see if I can embed it here. Now it works.)
The S2 periodically plays a note. The pitch of the note is dependent on the range detected by the ultrasound sensor. The S2 will play high pitched notes when the range is close. The interval between notes also decreases for close range readings.
As the program is now, the robot speeds a lot of time driving across the room it's in. I might modify the program latter to follow a wall or to try to find the farthest point away from its starting position.
I'm pleased with the program so far.
In the video, both the serial pin and the analog pin on the MaxBotix sensor are connected to the S2. The attached program only uses the information from the serial pin since it has better resolution than using the S2's ADC method.