Log in
Sign up for FREE
arrow_back
Library

Unit 3 Repeating Behaviors

star
star
star
star
star
Last updated over 2 years ago
22 questions
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
Required
1
These lessons introduce us to vr.vex.com where we will learn the basics of programming virtual VEX robots. The site codeV5.vex.com is where we will code the physical VEX robots. We will go through this in class together as a whole group, primarily mirroring my actions on your own device and taking screenshots at certain steps in the procedures. We closely follow the text and directions, so if you are unable to complete it with us, you may do it on your own or see me during Advisement. This unit is very important, so it will probably take two class periods.
Question 1
00:22
Question 2
2.

Take a screenshot of your work showing the box your robot has drawn. Your project should be correctly named, the code and the playground window should be visible, and the date and time should be in the bottom right of the screenshot. Paste the screenshot into the "Show Your Work" box below.

For Your Information:

  • The [move robot pen] block can be used to pick up and put down the Pen tool on a VR Robot.

  • The [Set Pen color] block can be used to change the colors of the pen.
Question 3
3.

Mini-Challenge: Draw 2 boxes

Requirements:
  • The square on the right should be 600 by 600 millimeters (mm),
  • The smaller square on the left should be 300 by 300 millimeters (mm).
  • The squares should not be touching each other, so the Pen tool will need to be picked up after drawing the first square and then placed back down.

Take a screenshot of your work showing the two boxes your robot has drawn. Your project should be correctly named, the code and the playground window should be visible, and the date and time should be in the bottom right of the screenshot. Paste the screenshot into the "Show Your Work" box below.

Question 4
4.

Question 5
5.

The [Repeat] block is used to repeat the blocks within it a set number of times. The [Repeat] block saves time and effort while creating projects where blocks repeat. Rather than taking the time to drag in additional blocks or duplicate existing blocks in the workspace, the [Repeat] block can be used to save space and time.


PROGRAM FLOW:
When a project uses a [Repeat] block, it still follows the same logic while executing the commands. These two stacks of blocks will execute the same behaviors. The only difference is that the stack of blocks on the right utilize a [Repeat] block.

The VR Robot will move through the commands from the [When Started] block to the bottom of the stack. The [Repeat] block indicates that the VR Robot should repeat the actions inside of the block the specified number of times before moving on to the next block in the stack after the [Repeat] block.

The specified number of times that the [Repeat] block is set to execute creates a ‘condition.’ Conditions allow the user to control the flow of a project. The condition of the [Repeat] block must be met before the project will move on to the next block in the stack. The condition created in the following example is to ‘repeat the [Drive for] and [Turn for] commands four times.’

Question 6
00:07
For Your Information:

The [Repeat] block can accept integers. Decimals will not work as a parameter for a [Repeat] block.

Question 7
7.

Question 8
8.

Question 9
9.

Question 10
10.

Question 11
11.

Question 12
12.

In this challenge, create a project where the VR Robot draws a house on the Art Canvas Playground using [move robot pen] and [Set Pen color] blocks as well as a [Repeat] block. Use a square for the house and triangle for the roof. Both the house and the roof should be different colors. There are many ways to do this, here is one example:


Make sure to save your project "YourFirstName_Unit3".

Take a screenshot of your work showing the house your robot has drawn. Your project should be correctly named, the code and the playground window should be visible, and the date and time should be in the bottom right of the screenshot. Paste the screenshot into the "Show Your Work" box below.

Question 13
13.

Upload the code for the house you just finished drawing. It should be titled "YourFirstName_Unit3".

Question 14
14.

Question 15
15.

Question 16
16.

Question 17
17.

Question 18
18.

Question 19
19.

Question 20
20.

Question 21
21.

Question 22
22.

DO THIS:
This example will have the VR Robot draw a square on the Art Canvas Playground.


  • Launch VEXcode VR at vr.vex.com.
  • Once you launch VEXcode VR, a new project will automatically start.
  • To name your project, select the project name box.
  • Enter the new project name YourLastName_Unit3, and select “Save.”

  • Drag in the [move robot pen] block and attach it beneath the [When started] block.
  • Drag in the [Drive for] block and attach it below the [move robot pen] block. Set the parameters of the [Drive for] block to 600 millimeters (mm).

  • Drag in the [Turn for] block and attach it beneath the [Drive for] block. Set the parameters of the [Turn for] block to turn right 90 degrees.

  • To draw the second side of the square, duplicate the [Drive for] and [Turn for] blocks. To duplicate, right click or long press on the [Drive for] block.
  • Additional [Drive for] and [Turn for] blocks are now added to the stack.

  • To draw the last two sides of the square, duplicate the [Drive for] and [Turn for] blocks. Right click or long press on the first [Drive for] block in the stack.
  • The stack of blocks will then be duplicated. Your code should look like this:

  • Select the “Open Playground” button to open the playground.
  • Open the Art Canvas Playground.
  • Select the “Start” button to test the project.
  • The VR Robot will drive forward for 600 millimeters (mm) and then turn right for 90 degrees, while drawing with the Pen tool. The VR Robot will repeat these behaviors four times to draw all four sides of the square.
Which two of the following blocks is used to lift up the VEX VR Pen?
[Move robot pen] block
[Set print precision] block
[Set Pen color] block
[Set print color] block
What color lines can the VEX VR Pen NOT draw?
Red
Yellow
Blue
Green
DO THIS:

  • Begin by modifying the previous project or creating a new project to match this base project's code. In other words, make it look like this:


  • The repeated blocks in this project are the [Drive for] and the [Turn for] blocks. Remove the bottom six blocks in the project so only one [Drive for] and one [Turn for] block is left beneath the [move robot pen] block.


  • Drag in a [Repeat] block. Notice that the [Repeat] block will create a gray shadow around the blocks that will be inside when placing the block in the workspace.

  • Set the parameter of the [Repeat] block to “4” so a VR Robot draws all four sides of a square.

  • Select the “Open Playground” button to open the Art Canvas Playground if it is not already open.
  • Select the “Start” button to test the project.
  • Watch the VR Robot drive forward and turn right four times on the Art Canvas Playground to draw a square with the Pen.
Which of the following blocks is used to repeat the blocks inside of it for a set number of times?
[Repeat] block
[Break] block
[Forever] block
[Wait until] block
True or False: The [Repeat] block can accept decimals as parameters.
True
False
True or False: Conditions, like the number of times repeated, are used to end a [Repeat] block.
True
False
Which of the following describes why a [Repeat] block would be used in a project?
To only run a stack of blocks one time.
To repeat certain blocks forever.
To save space and time for blocks that repeat more than once in a project.
To run an attached stack of blocks when the project is started.
Describe how the VR Robot will move in this project.
The VR Robot will set the pen down and drive forward one time for 200 millimeters (mm) before turning 90 degrees four times.
The VR Robot will set the pen down and draw a straight line for 200 millimeters (mm) and then turn right for 90 degrees.
The VR Robot will set the pen up and down four times before driving forward and then turning right 90 degrees.
The VR Robot will set the pen down, then drive forward for 200 mm and turn right for 90 degrees; and repeat this 4 times in order to draw a square.
This project was used to draw a house on the Art Canvas Playground, but it does not work correctly. What is the error?
The [Repeat] block was set to three, but it should be set to four in order to draw the square portion of the house.
There is no need for the [Repeat] block, as the VR Robot should only drive forward and turn once.
The [move robot pen] block should be at the bottom of the project.
The [Drive for] blocks should be replaced with [Drive] blocks.
What is the first step in coding the VR Robot to move the VR Pen down to draw a black line?
Drag the [Turn for] block into the workspace and set the parameter to "400 millimeters (mm)".
Drag the [move robot pen] block into the workspace and use the drop-down menu to set the position to "down".
Drag the [move robot pen] block into the workspace and use the drop-down menu to set the position to "up".
[Drive for] block set to 2000 millimeters (mm).
What is the first step in coding the VR Robot to draw a red line?
Drag the [Set Pen color] block into the workspace and use the drop-down menu to set the color to "blue".
Drag the [Set Pen color] block into the workspace and use the drop-down menu to set the color to "red".
Drag the [Turn for] block into the workspace and set the parameter to "200 millimeters (mm)".
Drag the [move robot pen] block into the workspace and use the drop-down menu to set the position to "up".
How many times will the [Repeat] block repeat the [Turn for] and [Drive for] blocks inside of it?
Two times.
Three times.
Only once.
Four times.
What types of values can the [Repeat] block accept as parameters?
Words or text.
Decimal values.
Integers.
Negative values.
What is the condition that will end this [Repeat] block?
After the VR Robot has driven forward 200 millimeters (mm) then turned right 60 degrees six times.
After the VR Robot drives forward one time for 200 millimeters (mm).
After the VR Robot places the pen down.
After the [Repeat] block has repeated the blocks inside of it four times.
How can the following example be simplified by using a [Repeat] block?
By changing all of the parameters of the [Drive for] blocks to 400 millimeters (mm) instead of 200 millimeters (mm).
By placing the [Drive for] and [Turn for] blocks in a [Repeat] block that repeats four times.
By placing the [Drive for] block in a [Repeat] block that repeats four times.
By placing the [Turn for] block in a [Repeat] block that repeats four times.
When will the VR Robot move the VR Pen up?
Before the VR Pen is set to the color red.
After the [Repeat] block has repeated all of the blocks inside of it six times.
After the [Repeat] block has repeated all of the blocks inside of it twice.
Before the [Repeat] block has repeated all of the blocks inside of it twice.
The following project was created to draw a house, but it is unfinished. Which of the following blocks should be used next to begin drawing the roof of the house?
[Repeat] block set to six
[move robot pen] block set to "up"
Drive for block set to 2000 millimeters (mm)
[Turn for] block set to 135 degrees