I am doing a personal project and for this I need to use something to calculate distance, but the ultrasonic sensor doesn't respond as well as I want (I would like to use a sensor that has a straight vision, like a "laser" - the infrared can resolve this for me - and not like a sonar/radar - ultrasonic sensor) , so my second idea was by using the infrared sensor, but i am not achieving how to use this! I know that it's graphic isn't linear, so I don't know how to write a formula/function that works on it.
So, if someone could help me, please, say another ideia or another way to measure distance by infrared sensor (I don't want to use the ultrasonic sensor) or (the better solution) give me the program or function/formula to transfer the analog output voltage or the analog value (achieved by a simple "analogRead") to the measure in centimeters or in meters!
Thanks to everybody that could help me! And sorry for my english
My sensor is: SHARP INFRARED SENSOR - 2Y0A02 F 5X (range: 20 - 150cm) http://www.elec.mn/category/9/362