while (getDistance() < 40) { // If an obstacle is less than 20cm away
If you are going to have useless comments, you must keep them accurate.
I have soldered the sensor to D3 and have been able to read the results via serial.
You may have been able to read the results, and print them to serial. You can't read the results via serial.
The goal is to basically use the runaway robot with the NewPing library.
This makes no sense. The advantage of NewPing over the pulseIn() method of reading ping sensors is that you can do other things while waiting for pulses. Your sensor/device handles all the interaction with the pulse sender/reader, providing a variable voltage as output. So, almost no time is needed to read the sensor data. Not that it matters, since your code is full of delay()s that waste most of the robot's time, anyway.
The code you posted does something. You didn't explain what. You want it to do something. You didn't explain what. That you posted is likely an indication that the two somethings aren't the same thing, but that is all we know.