2560, ultrasonic, and buzzer

hi, new to arduino and my first project I thought I would easily find on the web, but seems a little difficult

All I want is to hook a four pin us sensor, a radio shack beeper, and my 2560 together to make a handheld distance sensor.

It seems most of the instructions I find is for the UNO and includes leds which I do not want. Also, a simple sketch is what I need for this. Can someone give me a link? I know its out there, but I am having a lot of difficulty and I think wasting a lot of time.

Also, if someone knows of a good simple book to help me with this kind of stuff. Thanks… Marc

Hi, code for UNO will work with mega as well. Example for ultra sonic sensor can be found here Google Code Archive - Long-term storage for Google Code Project Hosting.. You can also only use 3 pins for the sensor, Google Code Archive - Long-term storage for Google Code Project Hosting.

You can use a simple if else to activate your buzzer.

if( uS / US_ROUNDTRIP_CM > 10 ) //if distance bigger than 10cm
{
     digitalWrite(buzzerPin, HIGH);
}
else
{
     digitalWrite(buzzerPin, LOW);
}