mBot – Distance sensors

Materials

  • 1 mBot
  • 1 tablet with mBlock app

Step  1 : Connect the mBot to the tablet and go to the programming interface

Press dedicated button on the upper right-hand corner to connect to the mBot

Step  2 : Discover how to use the front sensor (Ultrasonic Sensor)

Use wait until block with obstacle ahead in Sense section to detect any obstruct in front of the robot.

or

Use the Control block forever until and the block ultrasonic sensor "___" distance with the Math block  ___ <___. The mBot will detect an obstacle at a chosen distance and will do what is inside the loop.

Step  3 : Challenge

Run these two tasks:

  • Make MBot move forward and when a barrier comes in front of it make it turn left

  • Make MBot move forward and when a barrier comes in front of it make it turn on red lights and stop