Hi, I'm trying to read the digital sensor distance of Sharp, precisely
this: GP2Y0D21YK0F
but I can not with arduino ... give me a hand in drafting the sketch and the circuit?
Thanks.
Hi, I'm trying to read the digital sensor distance of Sharp, precisely
this: GP2Y0D21YK0F
but I can not with arduino ... give me a hand in drafting the sketch and the circuit?
Thanks.
Datasheet GP2Y0D21YK0F : http://sharp-world.com/products/device/lineup/data/pdf/datasheet/gp2y0d21yk_e.pdf
"The output voltage of this sensor stays high in case
an object exists in the specified distance range. So
this sensor can also be used as proximity sensor."
So the sensor has to be attachted to a digital port not to an analog one. It can only switch on/off.
Connect both GND and +5V and Voutput to a digital port. Note the pull-up resistor of 12K in the block diagram - page 2.
Check - http://arduino.cc/en/Reference/DigitalRead - for elementary code.