How to make a LED flash with a Paralax Ping))) sesnor

Hey

Can you please help me, i have got this code ( at the bottom, also see attached for coding screen ) and i want to use this code but without the buzzer and just the LED but on the Arduino coding Software it says " ‘Ping’ does not have a type." PLEASE HELP?

Code:

[code]
#include <Ping.h> // Import Ping Library
const int sensor = 8; // Pin Sensor to be connected on pin 4
const int buzer = 9; // Buzzer connected on pin 6
const int led = 10; // LED connected to pin 8
int distance; // Save the Distance Detected by the sensor
int pause; // Save Waiting Time Between Flashing
Ping ping = Ping(sensor); // Create the Odject Ping
void setup(){
pinMode(buzer, OUTPUT); // Declare The Buzzer as an OutPut
pinMode(led, OUTPUT); // Declare the LED as An OutPut
}
void loop(){
ping.fire(); // Starts the Sensor
distance = ping.centimeters(); // Return the Distance In Centimetters

if(distance < 100) { // If The Objec is Less than 100 Cm
pause = distance * 10; // Calculate the Distance
digitalWrite (buzer, HIGH);// Turn ON Buzzer
digitalWrite (led, HIGH); // Turn ON LED
delay (pause); // Wait Time To Stop
}
digitalWrite(buzer, LOW); // Turn Off Buzzer
digitalWrite(led, LOW); // Turn Off LED
delay (pause); // wait Time To Stop
}[/code]

It seems that your Ping library is missing. Have you downloaded it from the Arduino website?

You can save the Ping-2_0.zip file to your computer, and then use the Sketch -> Import Library -> Add Library menu in the Arduino IDE to import the files into the IDE at the right place.

Hey

No i didn’t get it off the Arduino Website, that one does not make the LED flash when the object gets closer but this one does.

Ok, you don’t need to use the examples, but you still need the to install the library so that your code can use the Ping class.

Right now, there’s an error because it doesn’t know what you mean by

Ping ping = Ping(sensor);

because there’s not Ping library installed.

Ok. I will do that and then can I just copy the parts that I want from that code and past it?

I don’t think you will even need to copy or modify any of your code. Just once the library is imported into the Arduino IDE environment, do Compile again and it should work.