Help connecting GP2Y0D810Z0F to 3pi robot

How can I connect the GP2Y0D810Z0F sensor to my 3pi robot? I know that one pin goes to ground , the other one goes to the power supply but where do I connect the third one? What commands can I use to display the reading (using c language?

Hi.

One option is to connect your sensor to PD0. To read the sensor, you will first need to set that pin as a digital input:

set_digital_input(IO_D0, HIGH_IMPEDANCE)

You can then read the sensor output by calling:

is_digital_input_high(IO_D0)

When the sensor detects an object, this function will return zero.

-Derrill

Hi Derril,
This was exactly what I needed to know. Thank you so much for your reply.