In this activity, students recreate the functionality of Mode B–Obstacle Avoidance of the Default Program. Students learn how to read data from the Ultrasonic Sensor in order to measure a distance, control the frequency of a sound from the mBot Buzzer, and trigger the program to autonomously avoid obstacles. Students frequently use the Ultrasonic Sensor in other activities, so we highly recommend doing this activity before attempting later activities.
- Learn about Mode B of the Default Program.
- Practice writing code, uploading and running a program on mBot, and troubleshooting when problems arise.
- Learn how the Ultrasonic Sensor works.
- Practice using variables, “if-then-else” blocks, and loops in mBlock.
- Use the Ultrasonic Sensor to control sound frequency.
- Write code to develop obstacle-avoidance programs for mBot.