Recommended for Middle School through High School.
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.
Sensors and Equipment
This experiment features the following Vernier sensors and equipment.
You may also need an interface and software for data collection. What do I need for data collection?
Computer Science Teachers Association (CSTA) Standards
- Create clearly named variables that represent different data types and perform operations on their values.
- Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.
- Decompose problems and subproblems into parts to facilitate design, implementation, and review of programs.
- Document programs in order to make them easier to follow, test, and debug.