Parrallax Ping))) sensor + servo

Hi, i am trying to set up an ultrasonic ping sensor to trigger a Futaba servo to move from left to right, 20 degrees in each direction. I am new to arduino, and so far, have succeeded in getting the serial monitor to give the distance using the example from the arduino sketchbook. If anyone has any idea what code i should it would be great. Many Thanks. :)

Could you give more details?

How does the Ping sensor 'trigger' the servo to move?

To get the servo to sweep, use this library:

It gives an example on how to sweep on the example that is in the library that ships with the Arduino IDE.


Have you got the "Sweep" sketch code working on your Arduino and servo?

Hi,thanks for your reply. Yes, i have the sweep sketch on arduino working, and also the Ping sensor example from the sketchbook. But they are working seperately and I'd like to connect them together, getting the ping to turn the servo on and off depending on the distance detected. Any ideas? The code would be something like "when distance of object is 10cm turn servo sketch on. Thanks.