Using Variables

Teacher Portal

Teacher Toolbox - Facilitating the Draw Square Sides 1 and 2 page

What the Teacher Will Do:

• Bring groups up to your Workcell for a whole-class demonstration.
• Show students how this project will draw side 1 and 2 of a square on the whiteboard.
• Call out that the square has a starting coordinate. This starting coordinate is what all other sides of the square are based from. The starting coordinate is (8, 0, 2). Explain to students that this coordinate was chosen ahead of time to ensure that as the arm draws the square, it will not move past its physical limitations, and also stays on the whiteboard surface.
• Explain to students that drawing the first side of the square is adding two inches to the x-value of the starting coordinate. Call out to students how the arm moved 2 inches along the x-axis in the positive direction.
• Explain to students that for the second side of the square, the arm does not remember its last location. The variables in this project only store the starting coordinate (8, 0, 2). To draw the second side of the square, we need to code the arm to add 2 inches in both the x and y-direction. Students may ask why the arm has to move to inches in the x-direction again. This is a common misconception for students as they may think that the arm 'remembers' its last location because of the variable used.
• Tell groups that they will follow the steps on this page and ask them to check in with you once they have completed the activity.
• Break students off to work within their groups. Walk around the room as students are working to answer any questions if they arise.

For additional information on how to facilitate this activity, go to the V5 Workcell Educator Certification.

Now that the 'Variables' project is created, you will use variables to code the arm on the Workcell to make linear movements along the x and y-axis. You will add blocks to your project to draw a square.

In VEXcode V5, follow the steps in this video to add a [Linear move] and (Add) block to the project. These blocks are used to code the arm to move 2 inches from the starting x-value, drawing the first side of the square.

Download and run the project. The arm will draw the first side of the square by moving 2 inches from the starting x-value.

If your arm did not draw the first side of the square, notify your teacher.

Once you have finished coding the arm to draw the first side of the square, stop the project.

Follow the steps in this video to add another [Linear move] and (Add) block to the project. These blocks are used to code the arm to move 2 inches from the starting x and y-values, drawing the second side of the square.

Download and run the project. The arm will draw the first and second sides of the square by moving 2 inches from the starting x and y-values.

If your arm did not draw the two sides of the square, notify your teacher.

Once you have finished coding the arm to draw the first two sides of the square, stop the project and check in with your teacher.

Teacher Tips

• If groups did not add their (Add) blocks correctly, their arm may draw a diagonal, as shown in this image.

• They will need to add the (Add) block to the x-variable in the third [Linear move] block. The corrected project will look like this image.

• In the videos above, a green circle around the cursor indicates a right-click while a black circle indicates a left-click.

Teacher Toolbox - Troubleshooting

If groups are finding that the arm does not draw the first two sides of the square when they run their project, try the following troubleshooting techniques.

1. Change the z-value in the startZ variable.
1. Your dry-erase marker may not reach the surface at point 2. Have students set lower z-values, like 1.5 or 1, and test the project.
2. Check the mastering values.
1. Instruct students to check that the mastering values they recorded in their engineering notebook during Seek match what is in the [Set mastering] block.
2. If the problem still persists, have students follow the steps in Seek to rerecord their mastering values.
3. Check the VEXcode V5 project.
1. Have students compare their project to the video on this page and ensure the order of the blocks match. Make sure students are re-downloading their project each time they make a change and before they run the project
4. Check the build.
1. There may be a mechanical issue with your Workcell. Instruct students to look at the Lab build instructions first and verify that the additions to their Workcell match.
2. Have students go back to the Lab 1 build instructions for a complete look at the build and check that all elements match. Even one small detail being wrong can affect the movement of the arm on the Workcell.

Teacher Toolbox - Check in

Review the following with the group during their check in:

• Ensure groups added the (Add) blocks in the correct places in the project. The second [Linear move] block should have an (Add) block for the x-variable, and the third [Linear move] block should have an (Add) block for both the x and y-variables.
• Ensure the marker touches the whiteboard surface when students run the project. If the marker does not come down far enough, tell students to adjust the starting z-value in the [Set variable] block for the startZ variable.