Computer Science Level 1 - Blocks

Unit 6 - Knowing Your Location

Lesson 3: Drive to Number ‘31’

In this Lesson, the VR Robot will drive to the number ‘31’ and then back to number ‘1’ on the Number Grid Map Playground!

Notice that the VR Robot will be traveling along the Y axis to move to the number ‘31’ on the Number Grid Map Playground.

The VR Robot will drive to the location of the number ‘31’ on the Number Grid Map Playground. However, before the VR Robot can navigate to that number, the VR Robot has to be told where that number’s location is. The coordinates of number ‘31’ are (-900, -300).

• Drag the [Drive] non-waiting block into the workspace.
• Attach a [Wait until] block beneath the [Drive] block.
• Drag the <Greater than> Boolean reporter block into the [Wait until] block.
• Note that the <Greater than> block is used instead of the <Less than> block because the VR Robot is driving up from the bottom of the Playground. The VR Robot is starting at a Y-value of -900 millimeters (mm). As the VR Robot drives forward, the Y-values increase.
• Drag the (Position of Robot) block into the <Greater than> block.
• Set the parameter of the (Position of Robot) block to “Y” and the parameter of the <Greater than> block to -300.
• Drag in a [Stop driving] block and add it to the project.
• Launch the Number Grid Map Playground if it is not already open and run the project.
• Watch the VR Robot drive to number ‘31’ on the Number Grid Map Playground.
• In this project, the VR Robot drives to the number ‘31’ on the Number Grid Map Playground. Since the Y-values are increasing as the VR Robot drives to the number ‘31,’ the project uses a <Greater than> block.
• The VR Robot will stop once its Y-value is greater than the Y-value of the coordinate that the indicated number is on. Since the Y-value of the number ‘31’ is -300, the VR Robot will stop driving once the Y-value is greater than -300.

Select the Next button to continue with the rest of this Lesson.