Hands-on Activity: Wait Program!

Contributed by: GK-12 Program, Computational Neurobiology Center, College of Engineering, University of Missouri

Two photographs: A LEGO MINDSTORMS NXT robot composed of a brick-sized computer and a servomotor, ultrasonic sensor and sound sensor, all on wheels—a small robot of plastic cases, parts, buttons and cables. A photo shows two hands clapping.
Students work as engineers to write programs in which their LEGO robots respond to clapping hands and human touch.
Copyright © (left) Eirik Refsdal, Wikimedia Commons; (right) Evan-Amos, Wikimedia Commons http://commons.wikimedia.org/wiki/File:Lego_Mindstorms_Nxt-FLL.jpg http://commons.wikimedia.org/wiki/File:Hands-Clapping.jpg


After completing the associated lesson, students test their understanding in two programming tasks that utilize LEGO® MINDSTORMS® NXT robots and sound/touch sensors. In the first challenge, students become acquainted with wait blocks by designing programs to simply make robots move forward until "hearing" a noise, and then turn left. The second, more challenging activity pushes students to fully understand the potential of wait blocks. They create programs that make the robots change speed several times when a touch sensor is pressed. Students gain practice in the iterative design-program-test-redesign process. A PowerPoint® presentation, pre/post quizzes and worksheet are provided.
This engineering curriculum meets Next Generation Science Standards (NGSS).

Engineering Connection

Engineers and scientists frequently write programs to assist them in solving problems. Often, these programs perform simulations or mathematical operations to help them analyze the results of many different inputs. As a result, computer programs must be flexible enough to deal with variable conditions, not just one specific case. For example, if programming a calculator, the program must be able to operate on any two numbers that might be entered.

In the first lesson in the unit, the programs were only good for navigating through a maze with precisely the given measurements. In the calculator example, this is analogous to being able to compute 1+2 correctly but not accounting for any other possible inputs. Using wait blocks, we can program robots to account for variable conditions, for instance, to move forward any distance until running into a wall. The skill of designing solutions that can handle a variety of conditions is incredibly useful in engineering and in life.

Pre-Req Knowledge

Completion of the associated lesson so that students are ready to create their own NXT programs using wait blocks.

Learning Objectives

After this activity, students should be able to:

  • Program the LEGO MINDSTORMS NXT robot using sensors to accomplish useful tasks.
  • Explain how the wait block functions and provide reasons for using it in programming LEGO robots.

More Curriculum Like This

How Do You Make a Program Wait?

Building on the programming basics learned so far in the unit, students next learn how to program using sensors rather than by specifying exact durations. Working with the LEGO® MINDSTORMS® EV3 robots and software, they learn about wait blocks and how to use them in conjunction with move blocks set ...

How Do You Make Loops and Switches?

Students learn how to program using loops and switches. Using the LEGO® MINDSTORMS® robots, sensors and software, student pairs perform three mini programming activities using loops and switches individually, and then combined.

What Is a Program?

Using a few blindfolds and a simple taped floor maze exercise, students come to understand that computers rely completely upon instructions given in programs and thus programs must be comprehensive and thorough. Students create and test basic programs, first using just the LEGO intelligent brick, an...

Elementary Lesson
What Is a Computer Program?

Through four lesson and four activities, students are introduced to the logic behind programming. Starting with very basic commands, they develop programming skills while they create and test programs using LEGO® MINDSTORMS® robots. The unit is designed to be motivational for student learning, so th...

Educational Standards

Each TeachEngineering lesson or activity is correlated to one or more K-12 science, technology, engineering or math (STEM) educational standards.

All 100,000+ K-12 STEM standards covered in TeachEngineering are collected, maintained and packaged by the Achievement Standards Network (ASN), a project of D2L (www.achievementstandards.org).

In the ASN, standards are hierarchically structured: first by source; e.g., by state; within source by type; e.g., science or mathematics; within type by subtype, then by grade, etc.

  • Generate and compare multiple possible solutions to a problem based on how well each is likely to meet the criteria and constraints of the problem. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • Plan and carry out fair tests in which variables are controlled and failure points are considered to identify aspects of a model or prototype that can be improved. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • Evaluate competing design solutions using a systematic process to determine how well they meet the criteria and constraints of the problem. (Grades 6 - 8) Details... View more aligned curriculum... Do you agree with this alignment?
  • Analyze data from tests to determine similarities and differences among several design solutions to identify the best characteristics of each that can be combined into a new solution to better meet the criteria for success. (Grades 6 - 8) Details... View more aligned curriculum... Do you agree with this alignment?
  • Various relationships exist between technology and other fields of study. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • The design process is a purposeful method of planning practical solutions to problems. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • Test and evaluate the solutions for the design problem. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • The processing of information through the use of technology can be used to help humans make decisions and solve problems. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • New products and systems can be developed to solve problems or to help do things that could not be done without the help of technology. (Grades 6 - 8) Details... View more aligned curriculum... Do you agree with this alignment?
  • Specify criteria and constraints for the design. (Grades 6 - 8) Details... View more aligned curriculum... Do you agree with this alignment?
  • Describe how new technologies have helped scientists make better observations and measurements for investigations (e.g., telescopes, electronic balances, electronic microscopes, x-ray technology, computers, ultrasounds, computer probes such as thermometers) (Grade 5) Details... View more aligned curriculum... Do you agree with this alignment?
Suggest an alignment not listed above

Materials List

Each group needs:

To share with the entire class:


It is very important in programming to know how to use a "conditional" statement. This means the program tells a computer or robot to do something IF a particular event happens.

In robots, sensors provide information about the environment around the robot, and this input helps robots decide what to do. For example, a robot might stop if an object is in front of it, or wait until it hears a clap and then move left. The ability to respond in this way makes the robots more useful. Today's activity will help you learn how to implement such "conditional" statements.


algorithm: A clear and specific procedure for solving a problem in a finite number of steps.

conditional command: A command in which the completion of an action depends on a condition being satisfied. (For example, if I see a stop sign [condition], I stop [action].)

engineering design process: A series of steps used by engineering teams to guide them as they develop new solutions, products or systems. This is a cyclical process that requires engineers to test and redesign prototypes as often as it takes so they end up with reliable finished solution.

iteration: Doing something again.

stimulus: Something that rouses or incites to activity. For the purposes of the lesson, it is an action that can be perceived by the robot that causes it to move on to the next part of the program.


Before the Activity

  • Gather materials and make copies of the Wait Program! Pre-Quiz and Wait Program! Post-Quiz, one each per student. Also, make copies of the Wait Program! Worksheet, two each per student, for the two programming challenges. The quizzes and worksheet are provided as separate attachments, and also embedded in the presentation to make it easier to go through them as a class, if desired.
  • Assemble a LEGO MINDSTORMS NXT taskbot for each group, following the instructions in the base set manual.
  • In advance, perform the entire activity so as to be familiar with all details, especially the programming solutions on slides 5 and slides 7-8.
  • Present the activity challenges and background information to students using the 11-slide Wait Program! Presentation, a PowerPoint file. Set up a computer/projector to show the presentation to the class.
  • Arrange for enough computers so you have one for each student group. Make sure each computer has the LEGO software loaded.

With the Students

  1. Administer the pre-quiz by handing out paper copies (also on slide 2). Answers are provided for the teacher on slide 3.
  2. Challenge 1: Introduce the first design challenge using slide 4: Program the robot to move forward until it hears a clap, then turn left.
  3. Distribute one worksheet to each student for the challenge 1 activity.
  4. Divide the class into student pairs. Direct them to work together to program their robots to complete the task using wait blocks, which they learned about in the associated lesson. This challenge uses a sound sensor.
  5. Once student groups have designed their programs, give them the following instructions:
  • Attach the sound sensor to the robot using instructions given in the base set manual. Then attach the sound sensor to port 2 of the LEGO brick.
  • Make sure the battery is fully changed. Then press the orange button to turn on the LEGO brick and plug it into the computer.
  • Download the program onto the LEGO brick by clicking the gray down arrow in the bottom right corner of the computer screen.
  • Test the program to verify that it works as desired to meet the challenge. As necessary, troubleshoot and fix any problems and re-download the program until it is successful.
  • Note: The programming solution is provided for the teacher on slide 5.
  1. Challenge 2: Use slide 6 to introduce a more challenging task that uses wait blocks: Write a program so that your robot:
  • Remains at rest until you press the touch sensor.
  • Once you press the touch sensor, moves slowly forward until you press the touch sensor again.
  • Once the touch sensor is pressed a second time, moves twice as fast.
  • Once the touch sensor is pressed a third time, moves twice as fast as before.
  • Once the touch sensor is pressed a fourth time, stops.
  1. Distribute a second blank worksheet to each student.
  2. Have student pairs write programs using wait blocks to accomplish this task. This challenge uses a touch sensor.
  3. Have student groups download their programs onto LEGO bricks and test to see if they work.
  4. Reinforce the engineering design process and how it is an iterative process. Like engineers, students typically must iterate their initial designs many times in order to get them just right and fix any problems in their programs. Learning to do this "iteration" is important to be a successful scientist or engineer, or anyone working to achieve the best solution to a problem.
  5. Note: Refer to the programming solution on slides 7-8 to check student programs.
  6. Administer the post-quiz by handing out paper copies (also on slide 9). Answers are on slide 10. Vocabulary are provided on slide 11.



Pre-Activity Assessment

Pre-Quiz: Administer the three-question Wait Program! Pre-Quiz (also on slide 2) to assess students' retention of knowledge about conditional commands, wait blocks and move blocks from the associated lesson. Answers are provided on the Wait Program! Pre-Quiz Answer Key (and slide 3).

Activity-Embedded Assessment

Worksheets & Iterations: For both programming challenges, have students first complete Wait Program! Worksheets to ensure they have good ideas of what they want to program and to guide them through the program development design process. Like engineers, it is extremely rare for students to create programs that navigate the robots perfectly through the maze the first time, so do not be worried if students take some time and repeated efforts to do this. The teacher should, however, know the solution well (provided in the slides) and ask pertinent questions to guide students to successful solutions. Review students' worksheet answers to gauge their comprehension of the concepts covered.

Post-Activity Assessment

Post-Quiz: Have students complete the Wait Program! Post-Quiz (also on slide 9), which presents two of the same questions as the pre-quiz, as well as a review of the concept of an algorithm. Expect students to be able to provide more informed responses to the post-quiz questions after completing the activity. Answers are provided for the teacher on the Wait Program! Post-Quiz Answer Key (and slide 10).


NXT User's Guide. Accessed Jul 17, 2013 http://goo.gl/wuhSUA


Riaz Helfer, Pranit Samarth, Satish S. Nair


© 2014 by Regents of the University of Colorado; original © 2013 Curators of the University of Missouri

Supporting Program

GK-12 Program, Computational Neurobiology Center, College of Engineering, University of Missouri


This curriculum was developed under National Science Foundation GK-12 grant no. DGE 0440524. However, these contents do not necessarily represent the policies of the National Science Foundation, and you should not assume endorsement by the federal government.

Last modified: February 12, 2018