Skip to main content
Teacher Portal

Programming with Variables

Teacher Toolbox icon Teacher Toolbox - Activity Outline

In the following activity, students will explore how variables are used to store values in a VEXcode V5 project. Students will use three variables to start the arm mounted on the VEX V5 Workcell at the origin (0, 0, 1.5). Once the arm mounted on the V5 Workcell starts at the origin, it will move one inch along the x and y-axes to draw a line using a dry-erase marker.

Students will first create three variables, one for each of the three x, y, and z coordinate axes. Students will utilize these created variables and blocks from the ‘Arm,’ ‘Control,’ ‘Operators,’ and ‘Variables’ categories to program the V5 Workcell’s movement.

Students will finish the activity by using variables and repeat loops to move the arm mounted on the V5 Workcell using incremental movements.

Materials Required:
Quantity Materials Needed
1

VEX V5 Workcell

1

VEXcode V5

1

Engineering Notebook

1

Device to run VEXcode V5

1

Micro-USB cable

1

Dry-erase marker

Teacher Tips icon Teacher Tips

  • Insert paper under the whiteboard for increased clarity if desired.
  • Ensure the V5 Battery is charged before beginning.
  • Ensure the V5 Brain is connected to a device before beginning.
  • Point students to the VEX Robotics Knowledge Base if they have further questions about VEXcode V5 or the hardware.
  • Ensure students have their mastering values readily available from Lab 1.
  • Start the activity with the dry-erase marker attached to the arm mounted on the VEX V5 Workcell.
  • Ensure the students change the [Set tool] block to ‘marker.’ If this is missed, the V5 Workcell may not move as intended.
  • A rubber band can be placed around the dry-erase marker on the arm mounted on the V5 Workcell to better hold it in place if it is not staying in position.

In this section, you will explore how variables are used to store values in a VEXcode V5 project. You will use three variables to start the arm mounted on the VEX V5 Workcell at the origin (0, 0, 1.5). Once the arm mounted on the V5 Workcell starts at the origin, it will move one inch along the x and y-axes to draw a line using a dry-erase marker.

You will first create three variables, one for each of the three x, y, and z coordinate axes. You will then utilize these created variables and blocks from the ‘Arm,’ ‘Control,’ ‘Operators,’ and ‘Variables’ categories to program the V5 Workcell’s movement. To finish the activity, you will use variables and repeat loops to move the arm mounted on the V5 Workcell using incremental movements.

You will begin by creating the ‘Variable’ project.