In this assignment you will practice the following computer science concepts in a team or small group environment:

Computer Science Principles Curriculum

Common Core Standards


In this challenge students will move their robot through an obstacle course of thier own creation while meeting certain minimum requirements.

Goal 1: Learn how to play a .WAV file on the robot.

In order to play a .WAV file on your computer, follow these instructions:

  1. Instantiate a sound object as you've learned in previous lessons.
  2. Upload a .WAV file to the SD card on the robot.
  3. Use the PlayAudio action to play a wave file

Use this code template for your file, changing the path name to the location of the .WAV file on your PC. In this example, our WAV file is located in a directory called "assets" in our main project folder.

use Libraries.Robots.Lego.Sound
use Libraries.System.File

Sound soundCtrl
File soundFile


In your pattern, you must use at least one RotateToDegree statement and one RotateByDegrees statement. You can combine them as you want to what better fits your pattern.

Example: One way to combine both statements.

motor:SetSpeed("B", 600)
motor:SetSpeed("C", 600)
motor:RotateToDegree("B", -1080)
motor:RotateToDegree("C", -1080)
motor:RotateToDegree("B", -3700)

Activity: Combine both statements to do your pattern.

Read the checklist and use both statements the way you prefer to complete all the movements parts of it.

Goal 2: Using the Quorum Lego Library to wait the button to be pressed to perform a task

To wait for the button to be pressed you will need to use the Button library that is also inside the Lego library and you also need to instantiate a new Button object called button. You will use the WaitForButtonPress statement to wait for button to be pressed. The WaitForButtonPress doesn't take any parameters.

Example: Use the WaitForButtonPress.

// This line waits the button to be pressed 

Use this example to wait for the button to be pressed to run the code given early in this challenge.

Activity: Use the WaitForButtonPress statement.

Indicate when the program is waiting for the button to be pressed by using the LED and the tones. To do it you will use the Button library and the Sound library that are inside the Lego library and instantiate a new Sound object called sound. The command to turn on the LED is the SetLightPattern that takes one parameter, the number of the pattern.

Example: Turn on the LED.

// This line turns the LED on

This example is turning the LED on in the pattern 1, that is the LED green and solid.

Activity: Turn the LED on, and make it blink

In this activity you will have to choose one pattern to your LED. You can choose the color but it must blink while waiting, so it must be the patterns 4(green), 5(red) or 6(orange).

The command to play tones is the PlayTone that takes two parameters, the frequency and the duration of the tone.

Example: Play a tone.

// This line plays a tone
sound:PlayTone(710, 100)

This example is playing a tone in the frequency of 710 Hertz with duration of 100 milliseconds.

Activity: Add tones

In this activity you will have to choose one tone to play while waiting for the button. Now you should insert these lines of code right before the lines with the command to wait for the button. And because you want the LED to be on just while waiting, right after the wait for the button command you should add a line to leave the LED without any color. The pattern that represents that is the pattern number 0.

Example: Turn off the LED.

// This turns off the LED

Sample Output

Each student will have a different pattern but all of them must include:

Next Tutorial

In the next tutorial, we will discuss Control Structures, which describes how work control structures in Quorum..