This low range sensor is widely used on robotics. The datasheet of CNY70 can be found on the Vishay website.
Hier I show how to connect a CNY70 sensor in order to obtain an analog otput proportional to the observed colour.
With this configuration the output signal is:
black color –> 5V –> 1
White color –> 0V –> 0