Skip to main content

Change targetX

  1. Select and drag the [Set variable] block from the ‘Variables’ category in the Toolbox and attach it to the [Set tool] block.

    Add set variable block

  2. Change the variable of the [Set variable] block to ‘targetX.’

    Change targetX
  3. Repeat steps 11 and 12 to add two more ‘Set variable’ blocks for ‘targetY’ and ‘targetZ.’

    Set variable xyz
  4. Since the arm mounted on the VEX V5 Workcell will start at the origin (0, 0, 0) the [Set variable] blocks for ‘targetX’ and ‘targetY’ should be set to ‘0.’ However, due to the dry-erase marker being raised slightly, ‘targetZ’ should be set to 1.5.

    set targetZ

    Note: the value of ‘targetZ’ may vary slightly depending on the mastering values and the size of the dry-erase marker being used.

  5. Select and drag the [Linear move] block from the ‘Arm’ category in the Toolbox and attach it to the third [Set variable] block.

    add [Linear move] block
  6. To move the arm mounted on the V5 Workcell one inch forward on the x-axis, a math block is needed. Select and drag the (Add) block from the ‘Operators’ category in the Toolbox and place it in the ‘x’ parameter of the [Linear move] block.  

    Add block
  7. Select and drag the ‘targetX’ variable block from the ‘Variables’ category in the Toolbox and place it in the first addend of the (Add) block. Set the value of the second addend of the (Add) block to ‘1.’

    targetX in add
  8. Place the ‘targetY’ and ‘targetZ’ variables in the associated ‘y’ and ‘z’-axis parameters in the [Linear move] block.

    xyz in Linear move block
  9. Download and run the project.

    Download and run

    Note: if the dry-erase marker is not drawing well, adjust the z-axis values to provide more force.

  10. Observe that the arm mounted on the V5 Workcell drew a straight line (linear motion) one inch along the x-axis.

    x1
  11. Stop the project.

    Stop the project