help using a ping))) senser

i got a ping senser from radioshack and have done the demo on the arduino website but i want to use the ping and arduino to use it to blink an led if 1cm away or something so please help no problem with my arduino or computer

What is the minimum range of a Ping? 1cm is awfully close.

not the point i want to use the ping for something deferent the demo sketch

I'm not sure what you're saying - the demo sketch gives a range in either inches or centimetres, so it isn't hard to put in a simple test and light a LED based on the result of the test.

However, the Ping may simply not be able to measure down to 1cm - I don't have one, so I can't test, but at 40kHz in air, wavelength is around 8mm, so a multi-cycle pulse won't even have left the transmitter before you're asking the receiver to measure it.

From the Ping datasheet: "The Parallax PING))) ultrasonic distance sensor provides precise, non-contact distance measurements from about 2 cm (0.8 inches)"

So, it looks like 1cm is out of the question.

In radar terms, this is called main bang suppression - you don't want the receiver (which is located close to the transmitter) to listen for the echo until the pulse is well on its way to the target. Interestingly, bats have evolved their own main bang suppression - a linkage between jaw and eardrum that prevents them deafening themselves with their own chirps.

im sorry i was not clear i dont want or need to have the ping detect 1cm all i what is some help understanding how to use the ping for something deferent from the demo sketch

Different like what? You want it to measure the speed of an approaching object? Can you be more specific, or I'm just going to be playing guessing games.

i want something that if if an object gets to close an led turns on and when it goes away the led turns off without needing to be connected to the computer meaning i could use it with a battery

OK, so you just need to take readings, like in the example.
If there is no object present, you will have a larger value for the range than if the object is in front of the sensor.
All you need to do is test to see if the range value is less than some fixed value (possibly using the “less than” operator “<”), and if it is, light the LED.
You can probably do this by adding two or three lines to the example code.

thank you for helping me :grin:

You can leave in the serial prints, even if the Arduino isn't connected to a computer, so you'll have a simple way of debugging, should you need it.

At the moment, the code is set for slightly fewer than ten readings per second ("delay (100);") - if you don't need this kind of responsiveness, you could save a little battery life and increase the delay.