Hi all, I'm struggling to " read " my Sharp IR GP2Y0D340K Sensor.
Firstly I want to know how to connect the sensor to the arduino. If have looked and followed the diagram of the sensor in the following link : http://sharp-world.com/products/device/lineup/data/pdf/datasheet/gp2y0d340k_e.pdf (note it's a pdf file). I have wired the sensor to the arduino by connecting the pin 1 of the sensor to the 3.3 V on the arduino, pin 2,4 and 5 of the sensor to the ground of the arduino with the neccesary componnets (capacitator and resistor), and pin 3 to the analog input pin of the arduino. Is this correct?
I then used the simple AnalogReadSerial aswell as a modified AnalogInOutSerial example in the library of the arduino. Again, is this correct? When I open the serial monitor I only receive a constant value which doesn't change if the sensors orientation changes or the distence changes. I know this a proximity sensor which only gives output values, I think of 1 and 0, but the sensor gives me readings from 0 to 1023, but these values differ on the start of the serial monitor , not through out the "running" of the code.
Can someone please help me with : connecting the sensor to the arduino correctly if it isn't and help me with reading the sensor correctly so that it only gives a value of 1 or 0. Any help will be grately appreciated, or even just a link to website that can help me. Tnx all.