Trouble with HC-SR04

seanz2003:
Next I tried an example from the new Ping library:

#include <NewPing.h>

.....




And all I get in output are zeroes. (0=0cm). I can hear it clicking but I'm beginning to think it may be defective. Any Ideas?

You have one sensor you're having a problem with, but you tried using the example sketch that's designed for 15 sensors using interrupts? Seems like if you're having a problem you should be starting with the basics. For example, use the Simple NewPing Example Sketch instead.

If that still doesn't work, you should do some basic troubleshooting. For example, try using different pings (the example sketch above uses pins 12 and 11, use those instead as you may have bad pins on your Arduino). If it still doesn't work, verify all your jumper cables are connected correctly (there's a diagram at the bottom of the above linked page). Next, replace your jumper wires with different ones. I've seen several times now where people are having a problem and they think their sensor is bad, only to find out that their jumper wires are broken (this is quite common).

One thing can be said for sure. If you use the NewPing library, use the example sketch linked above, use the exact pins in that sketch, and wire the sensor correctly, a good sensor WILL work in all cases.

Also, no reason to open a new thread with an ultrasonic sensor question, you can just ask on the NewPing thread if you're trying to get your sensor to work with NewPing.

Tim