LineSensor
Smart CarSees a dark line on a light floor. Each eye shines infrared light at the ground and measures how much bounces back: dark surfaces send back less.
How you reach it
Section titled “How you reach it”The LineSensor class is reached through this attribute of robot.
robot.line_sensor
Section titled “robot.line_sensor”Can be None.
All the attributes of robot are in its table. Read Attributes that can be None to see when a part is None.
Methods
Section titled “Methods”read(index)
Section titled “read(index)”Reads the eyes now: a list of 0/1, one per eye from left to right, or only eye index (0 is the leftmost).
read(index=None)Used in examples: Sensor check, Line follower
matches(pattern)
Section titled “matches(pattern)”True when the eyes read exactly pattern, a list such as [0, 0, 1, 0, 0].
matches(pattern) -> boolUsed in examples: Sensor check