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.