Ultrasonic sensor not responding

Yes, i understand what your saying and i have been testing these things out myself. The newest thing ive figured out is that it works unitl the distnace changes. Do you think there is anything wrong with the code?

teckel:

TheWave:
Ok, so now i am using different jumper wires and a different breadboard and it seemed to be working fine for a while. I plugged it in and got readings that seemed correct for roughly five seconds before it returned to the ol' 0cm 1149cm. Any ideas on that? Maybe the delay statement needs to be larger?

The fact that new jumper wires & breadboard yield different results means you must not be testing your circuit very well. And if that's the case, who knows what else is going wrong. We can't diagnose shorts or lose connections over a forum. It sounds like the sensor is working, as it's giving accurate measurements for a time. Set the ping delay to 1000ms, I don't know of any sensor that can't at least do one ping per second. You're going to have to diagnose the problem as well. For example, instead of asking if the delay statements need to be larger, you should simply change the 50 to a 1000 and try it yourself. Should 50ms work, yup! But, these sensors are made by 50 different Chinese companies with different components and logic. So, while all of mine can ping at a very high rate (at least 30 times a second) maybe yours can only don once per second. But, the only way to find out is for you to try it, as we don't have your hardware here to test it for you.

Tim