Do you need to figure out what's black and what's white? While we can't help you with your moral decisions, we can suggest using this analog line sensor to help keep your robot on track.
The line sensor is ideally suited for installation on the bottom of a chassis to help a robot follow its path, or so that it follows a line drawn on the ground.
However, this sensor can do more than distinguish black from white. Unlike the digital line sensor, it is able to distinguish different shades of gray. This ability is possible because the resultant signal is the average value of a small spot under the photocell. Being able to differentiate colors allows you to precisely control the process of how the robot interacts with the borders from black to white and vice versa.
The main photocell works in the infrared spectrum. Additionally, the sensor is equipped with an LED which lights up when the surface under the sensor is lit. This is convenient for configuration, diagnosis, and bug squashing.
A variable resistor mounted on the sensor will allow you to adjust the sensitivity over a wide range. With this you can calibrate the sensor to specifically suit your needs, depending on material coating and various external illumination conditions.
The output of the sensor is an analog signal. The lighter the surface under the sensor, the less its voltage it will output.
Connect via the 3-pin jumper cable to receive a signal from the scanner. The 3-pin jumper cable needed for the connection is included in the kit.
There are several different ways to wire this module:
Troyka Shield. The most straightforward method. Connect the module to a pin group on Troyka Shield with the 3-pin jumper cable and you’re ready to interface with it from your Arduino.
Troyka Slot Shield. The best choice for quick prototyping. Using slots on the shield, you can get rid of cables. The module will be held securely in place using both pin headers.
Breadboard. For advanced use. Troyka pin headers have 0.1” spacing which is compatible with any breadboard. Simply wire the module like you would do with any IC.