d8av3418q_PopBot X2 Line Tracking Robot 2024
d8av3418q_PopBot X2 Line Tracking Robot 2024
Line Tracking
Lesson 5
Objectives
a.) distinguish the four different scenarios of
PopBot X2 line tracking
❑ Detect an
edge
Hardware Setup
connect to port
A1 for Right IR
sensor
and port A0 for
Left IR sensor
• How to create a program for a
robot to follow a line tracing
map?
• Heart of line tracking robot is control the
robot to move over the line by sensors
position beside the line. The robot
moving along the line can be in 4
different scenarios.
1 s t S c e n a r i o : A c ti o n w h e n b o t h I R
sensors detect a white line
(1) Both sensors read
values that are white :
The robot will move
forward. Thus, this
program is written so
that the robot moves
forward normally.
2 n d S c e n a r i o : A c ti o n w h e n L e ft
IR sensor detects a black line
(2) The left sensor detects the
black line : This occurs when
the robot is slightly
turned to the right. Thus, the
program is written for the
robot to spin to the left to
resume its normal path
3 r d S c e n a r i o : A c ti o n w h e n R i g h t
IR sensor detects a black line
void loop() {