Freeze Dance

Name of Activity

Freeze Dance

Author

Jay Clark

Keywords

program, NXT, robot, dance, conditional, loop, conditional loop, sound sensor

Subject

NXTs

4, 5, 6, 7, 8, 9+

Time

1 Hour Total

Brief Description

Students program their NXT robots to dance! But wait! Using conditional loop structures, they must program their robot to stop dancing when the music stops, and start again when the music is turned back on.

Lesson Objectives:

Building for non-car NXT movement

Determining and implementing sensor thresholds

Materials Needed:

NXT kit including a sound sensor

A source and means of amplifying music

Computers with NXT Mindstorms software

Preparation and Set Up:

Clear a space in the classroom to serve as the dance floor, and mark it off with black tape (for the extensions). Set up your music system and find a volume that will register a readable sound level in the NXT.

Necessary Background

A loop is a helpful programming structure that allows you to repeat a set of commands. But sometimes, you don’t want to loop forever. A conditional loop will repeat the enclosed actions until some other criterion is met. A loop can be set to run for a certain amount of cycles of the loop, for a certain amount of time, until a logic condition is met, or until a sensor threshold is broken. This activity uses the last criterion in conjunction with the sound sensor to stop the robot from dancing.

Freeze dance is a game the children play in which they must dance when the music is on, but freeze when the music is turned off. If they don’t stop, or cannot hold the position they were in when the music stopped, they are eliminated.

Vocabulary:

Threshold – The sensor value that when breached, will trigger a wait for block or a conditional loop. (Some students have had a better time understanding it as a “benchmark”)

Procedure

Introduction 10 minutes Review loops with the students and why they are useful in programs.

• Loops allow us to repeat a set of commands that would otherwise be tedious to program over and over.

Sometimes loops should go on forever. Ask the students for examples they’ve done where loops go on forever. (Simple tasks like line following, wall following). In more sophisticated programs, they should not. Ask if they can think of a situation in which you don’t want a program to go on forever. A conditional loop is a great way to end a loop exactly when you want it to end and move on to another task. Our brains use conditional loops all the time!

•  When crossing the street, we look both ways. If its not safe, we do it again. We keep doing it until its safe, and then we cross the street.

Remind the kids or introduce them to freeze dance, and introduce the Activity. Activity 40 minutes Students should construct robots for about 15 minutes and program for at least 25 minutes. After 40 minutes is done. Put all the robots on the dance floor and start and stop the music. Clean up 5 minutes Wrap up 5 minutes

•  What was easiest? What was hardest?

•  What would you have done differently?

•  What were some good ideas you saw that other groups came up with?

Extensions:

Don’t bore us with those same old dance moves! Have the students’ robot switch up the dance moves after each pause.Programmatically, this involves an additional stop and a wait for sound block plus an additional looped dance sequence.

Allow students who finish quickly to explore the dance floor! have their robots move and groove while moving about the dance floor. Using their light sensor, they should detect that they’re about to leave the floor, and they should dance in a different direction. Programmatically, this would involve placing the dancing section of code in a switch or another conditional loop.

Page 1 of 2 | Next page