Further Investigate
This sketch uses two if-do blocks. Two actions will be executed within each if-do
block.
The first action of the if-do block deals with the motors. The if-do block tells the
Codee Bot to turn by sending power to one motor and braking the other based on
the condition of the Line Finder Sensor. Each if-do block is the opposite of the other.
This creates a series of turns that the Codee Bot uses to follow the line.
The second action of the if-do block deals with the red LED on the PULSE. The if-do
block tells the red LED to turn on or off based on the condition of the Line Finder
Sensor. This on-and-off action is synced with the turning action of the motors.
The actions in each if-do block work together to make the Codee Bot follow the line
while producing visual cues in the form of the blinking red LED.
Extension Activity
With the example as a reference, try creating a new sketch to have the Codee
Bot follow a black line. Remember what you have learned from your previous
activities. Challenge yourself to make the Codee Bot go faster and still follow the
line accurately or change the code to make the Codee Bot follow the line in the
opposite direction.
Real-World Link
The next generation of children’s rides are utilizing line-following sensors to operate
the rides. Little electric cars can drive toddlers along a path. A tiny train can follow a
figure eight path on the ground.
Careers: theme park manager, technical director, electrical ride control technician
STEM Connections
• Science
Ĕ Light reflection
Ĕ Angle of incidence
• Technology
Ĕ Thresholds
Ĕ Analog and digital
• Engineering
Ĕ Edging machines
Ĕ Self-driving vehicles
• Math
Ĕ Logic statements
Ĕ Numeric values
110 Building and Coding the PULSE CodeeBot