Vernier Software and Technology
Vernier Software & Technology

Obstacle Avoidance

Introduction

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.

Objectives

  • 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.

Option 1

Option 2

Additional Requirements

You may also need an interface and software for data collection. What do I need for data collection?

Computer Science Teachers Association (CSTA) Standards

2-AP-11
Create clearly named variables that represent different data types and perform operations on their values.
2-AP-12
Design and iteratively develop programs that combine control structures, including nested loops and compound conditionals.
2-AP-13
Decompose problems and subproblems into parts to facilitate design, implementation, and review of programs.
2-AP-19
Document programs in order to make them easier to follow, test, and debug.

Experiment C2 from Coding with mBot: Self-Driving Vehicles Activities Module Lab Book

<i>Coding with mBot: Self-Driving Vehicles</i> Activities Module book cover

Included in the Lab Book

Vernier lab books include word-processing files of the student instructions, essential teacher information, suggested answers, sample data and graphs, and more.

Buy the Book

Go to top