This example works well to follow small changes in the line for turns but will also adjust for sharp turns. You'll
follow the same steps to get the robot to start following a line. The only difference is that the robot will follow a
zigzagged course in this example. By default, the micro:bot will attempt to correct itself to eventually follow a track
in a counter-clockwise motion. Keep in mind that there are limitations in following a dark black line when only using
only two line following sensors. Additionally, the surface was not completely flat. As you can see from the GIF
below that the floor was rocking as the micro:bot was following the line. Adding more line following sensors can
help the micro:bot follow a line better and keep it from driving off the track.
Go Further: Your robot can go where you tell it by following a line. We've just scratched the surface for line
following problems. Here are some more challenges to explore and experiment:
Try adding more code to utilize the center line following sensor.
Instead of having the robot follow a counter-clockwise motion, try have the robot move in a clockwise
motion.
Adjust the code to follow a dark black line for a complex maze
Adjust the motor speed and remove the LED array to see how fast your line following robot can move
along the line without veering off the course.
Use the built-in accelerometer to increase the motor speed whenever the micro:bot is on a slanted
surface so that the robot can navigate rough terrain.
Add an additional mode to invert the condition statements to follow a light white line against a dark
surface instead of a dark black line against a light surface.
Try adjusting the width of your track to see if the robot can follow a more narrow line.
Troubleshooting
Robot Drives In a Circle - Double check your wiring and your code, your robot is not seeing the line. Also,
double check that there isn't something like dust blocking your sensor.
Need help?
Do you have a question about the micro:bot Kit and is the answer not in the manual?
Questions and answers