1. | Find the height such that when the sensor is under the white tape, the output voltage is barely a logic "HI" or 1, i.e. barely below 2.7 Volts. Let this height be max_height. |
2. | Now, find the height such that when the sensor is under a black surface, the output voltage is is barely a logic "LO" or 0, i.e. barely above 0.5 Volts. Let this height be min_height. |
3. | So, your "best" sensor height should be 0.5*(min_height + max_height). |
4. | You should know this height to the nearest millimeter. |