The CNY70 used to be a very common sensor to detect surfaces.
This low range sensor is widely used on robotics. In my case, I used it in my 3kg sumo robot for detecting the black or white colour of the floor.
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 analogue output proportional to the observed colour. I used 2 resistors: 220 Ohm and 10kOhm.
With this configuration the output signal is:
black colour –> 5V –> 1
White colour –> 0V –> 0