1.8K
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
Connection
Module Pin | Arduino pin |
Vcc | 5v |
L | Arduino Pin 4 |
C | Arduino Pin 5 |
R | Arduino Pin 6 |
Gnd | Gnd |
Code
[codesyntax lang=”cpp”]
// connect the sensors to digital pins #define LEFT_SENSORPIN 4 #define CENTER_SENSORPIN 5 #define RIGHT_SENSORPIN 6 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