Attention: Safety Recall of Vernier Go Direct Charge Station. Click to learn more.



Guided Navigation

Experiment #C3 from Coding with mBot: Self-Driving Vehicles


In this activity, students recreate the functionality of Mode C–Line Following of the Default Program. Students learn how to read data from the Line-Follower Sensor and use that data to guide mBot’s motion. During this activity, students build and try two different types of line-following programs in addition to testing mBot on courses of varying design.


  • Practice writing code and troubleshooting when problems arise.
  • Learn how the Line-Follower Sensor works.
  • Practice using variables, “if-then-else” blocks, and loops in code.
  • Explore the difference between edge-following and traditional line-following programs for mBot.

Sensors and Equipment

This experiment features the following sensors and equipment. Additional equipment may be required.

Ready to Experiment?

Ask an Expert

Get answers to your questions about how to teach this experiment with our support team.

Purchase the Lab Book

This experiment is #C3 of Coding with mBot: Self-Driving Vehicles. The experiment in the book includes student instructions as well as instructor information for set up, helpful hints, and sample graphs and data.

Learn More