This Tracking Sensor for Arduino can detect the white lines in black and black lines in white. This particular module has 3 sensors
Using infrared light detection, anti-interference ability
Built-in LED indicator lights
Sensor CTRT5000, high sensitivity, stable performance
Operating voltage 5V, output low black line, white line output high
This module worked with 3.3v as well in my basic tests
Connection
Module Pin | Arduino pin |
Vcc | 3.3v |
L | Wemos mini Pin 6 |
C | Wemos mini Pin 7 |
R | Wemos mini Pin 8 |
Gnd | Gnd |
Code
[codesyntax lang=”cpp”]
// connect the sensors to digital pins #define LEFT_SENSORPIN D6 #define CENTER_SENSORPIN D7 #define RIGHT_SENSORPIN D8 void setup() { Serial.begin(9600); pinMode(LEFT_SENSORPIN,INPUT); pinMode(CENTER_SENSORPIN,INPUT); pinMode(RIGHT_SENSORPIN,INPUT); } void loop() { // read input from sensors byte leftSensor=digitalRead(LEFT_SENSORPIN); byte centerSensor=digitalRead(CENTER_SENSORPIN); byte rightSensor=digitalRead(RIGHT_SENSORPIN); Serial.print(" Left : "); Serial.print(leftSensor); Serial.print(" Centre : "); Serial.print(centerSensor); Serial.print(" Right : "); Serial.print(rightSensor); Serial.println(); delay(1000); }
[/codesyntax]
Links
5V 3 Channel Infrared Line Track Tracking Tracker Sensor Module For Arduino