The GP2D12 will produce an analog voltage proportional to the distance to the nearest object viewable. The Stamp inputs have a threshold of about 2V so, when the GP2D12 output is greater than 2V, it will appear as a logic high and, when the GP2D12 output is less than 2V, it will appear as a logic low. This threshold is not guaranteed and may vary somewhat. If this works for you, you could dispense with the ADC. It's also possible to use the RCTIME statement to measure voltage. See www.emesystems.com and follow the "app-notes" link for further information.
Comments
The GP2D12 will produce an analog voltage proportional to the distance to the nearest object viewable. The Stamp inputs have a threshold of about 2V so, when the GP2D12 output is greater than 2V, it will appear as a logic high and, when the GP2D12 output is less than 2V, it will appear as a logic low. This threshold is not guaranteed and may vary somewhat. If this works for you, you could dispense with the ADC. It's also possible to use the RCTIME statement to measure voltage. See www.emesystems.com and follow the "app-notes" link for further information.