Distance Measuring Sensor
I connected the 2YA21 Sharp Infrared Proximity Sensor wires to the 5v, GND, and A0 pin. I then ran a simple program (included below) and read the subsequent values off the serial monitor.
The effective range of operation for this device is 0 to 1023.
Upon testing a few distances, I found that:
an object 20 cm away produced a value of approx. 253,
an object 40 cm away produced a value of approx. 140,
an object 60 cm away produced a value of approx. 88,
and an object 80 cm away produced a value of approx. 55.
Images and video below
Comments