You can use an ultra sonic tranceiver or ultra sonic distance sensor (the 2nd one costs more..). in 2nd case you get distance as output (serial o/p, PWM o/p ...) but i am not sure about the accuracy. i have seen distance sensors with 3mm accuracy. In case of using ultra sonic tranceiver, you have to interfacing and extra coding. The accuracy depends on your micro controller and ADC.
You can use an ultra sonic tranceiver or ultra sonic distance sensor (the 2nd one costs more..). in 2nd case you get distance as output (serial o/p, PWM o/p ...) but i am not sure about the accuracy. i have seen distance sensors with 3mm accuracy. In case of using ultra sonic tranceiver, you have to interfacing and extra coding. The accuracy depends on your micro controller and ADC.