Today we take a look at a line detection sensor from Pololu: #959 belongs to the family of QTR sensors followed by 1 RC which means 1 reader (instead of 3 or 8) and RC stands for a digital output instead of the series A for an analog output.
You can find more information under these product numbers on the manufacturer's website: #2454, #2455, #2456 and #2457.
Following the link to the Arduino Library for the Pololu QTR Reflectance Sensors, a separate library is available and after attaching the 3 PINs to the breakout board, a sample flash can deliver results in the serial monitor.
The prepared sheet of paper with a faint orange stripe from a board marker and the strong black from a marker.
The sketch describes a calibration time in which the integrated LED of the Arduino (A13) lights up. Moves the sensor over the recorded lines and the sensor "learns" during this time and displays the determined values in the serial monitor as a reference value.
With a read sensor and full detection, the log outputs "1000" - otherwise less to "0". Don't be confused by the other columns: the example sketch is universally applicable - also for up to 8 reading sensors.
A white line can also be set in the sketch:
// read calibrated sensor values and obtain a measure of the line position
// from 0 to 5000 (for a white line, use readLineWhite() instead)
uint16_t position = qtr.readLineBlack(sensorValues);
Take care that you and your robot stay on track!