3way Line Tracker Sensor Tutorial
3way Line Tracker Sensor Tutorial
s
to user indicating the existence of the line. Every sensor is provided with its own
ic
LEDs as indication of line detection.
on
tr
ec
El
r e
Features:
tu
w w w . f u t - e l c t r o n i c s . c o m Page 1
PRODUCT LAYOUT:
s
ic
on
tr
ec
El
Label Function
A Sensor Indicator LEDs
e
D LM 339
Fu
A – Sensor indicator LEDs (red) will light down showing that it detects line.
w w w . f u t - e l c t r o n i c s . c o m Page 2
Connection with Arduino
s
ic
on
tr
ec
El
r e
tu
Arduino Code:
const int PinL = 2;
const int PinC = 3;
Fu
int LState = 0;
int CState = 0;
int RState = 0;
void setup() {
w w w . f u t - e l c t r o n i c s . c o m Page 3
Serial.begin(9600);
pinMode(PinL, INPUT);
pinMode(PinC, INPUT);
pinMode(PinR, INPUT);
}
s
void loop() {
LState = digitalRead(PinL);
ic
CState = digitalRead(PinC);
RState = digitalRead(PinR);
on
if (LState == HIGH) {Serial.print(" black1"); Serial.print(" "); }
if (LState == LOW){Serial.print(" white1");Serial.print(" "); }
tr
if (CState == HIGH) {Serial.print(" black2"); Serial.print(" ");}
if (CState == LOW) {Serial.print(" white2");Serial.print(" "); }
ec
if (RState == HIGH) {Serial.print(" black3"); Serial.print(" "); }
El
Serial.println("****************************");
r e
delay(1000);
}
tu
Fu
w w w . f u t - e l c t r o n i c s . c o m Page 4
The Result:
s
ic
on
tr
ec
El
r e
tu
Fu
w w w . f u t - e l c t r o n i c s . c o m Page 5