A python object to measure distance using a Sharp 2Y0A21 (or similar) IR sensor.

A python object to measure distance using a Sharp 2Y0A21 (or similar) IR sensor.

Input from the sensor has to be dropped from 3V down to 1.8V using a voltage divider. Comments in the code should provide enough information on usage.

When run on its own the module will start the calibration routine and determine the coefficient and power for the voltage/distance equation.
https://gist.github.com/tdack/3a43fc42476eed293300