Coding the Pen of the VR Robot

Screenshot of VEXcode VR interface showcasing robot features, including a virtual robot model, coding blocks, and programming options, designed to facilitate learning in coding, robotics, and STEM education.

There are many commands used to code the Pen of the VR Robot:

  • Set Pen color
  • Set Pen width
  • Fill area with color

Set Pen Color

Screenshot of VEXcode VR interface showcasing robot features, including block-based coding elements and a virtual robot simulation, designed for educational purposes in programming and robotics.

The Set Pen color command sets the color of the VR Pen.

Screenshot of VEXcode VR interface showcasing robot features, including programming blocks and options for coding in a virtual environment designed for learning STEM concepts.

VEXcode VR Blocks

Using the sliders, select the red, green, and blue values for the color you want to create. The numeric value will be listed next to the color (0 to 255).

Opacity describes the transparency of the color. The opacity of the pen color can be selected using the bottom slider.

The color window will update to show the final color the pen will draw on the Playground. In this example, the pen would draw a red color with a lower opacity.

The color will also appear at the top of the pen once the project is run.

Screenshot of VEXcode VR interface displaying robot features, including a virtual robot model, programming blocks, and coding options, designed to help users learn coding concepts in a simulated environment.

VEXcode VR Python

The color of the pen is specified with: rgb values (red, green, blue).

Each parameter (red, green, and blue) defines the intensity of the color as an integer between 0 and 255.

The opacity describes the transparency of the color. Opacity is set using a value from 0 to 100 percent. This command will default to 100 percent for the opacity.

The color will also appear at the top of the pen once the project is run. In this example, the pen would draw a red color with a lower opacity.

Screenshot of VEXcode VR interface showcasing robot features, including a block-based coding environment and options for text-based programming, designed to facilitate coding education and robotics principles for students and educators.

Note that you cannot draw on the gray border on all four sides of the Art Canvas+ Playground. If you try to draw on this border, the line or patch of color will be cut off where the border is.


Set Pen Width

Example of varying pen widths in VEXcode VR, illustrating how different settings affect the line thickness when programming a virtual robot.

The Set Pen width command sets the width of the line the VR Pen will draw on the canvas.

This example was created using all five pen widths. It begins with the 'extra thin' at the left and moves in order through the 'extra wide' at the right.

Screenshot of VEXcode VR interface displaying robot features, including a virtual robot model, coding blocks, and options for programming, designed to aid users in learning coding concepts and robotics principles.

VEXcode VR Blocks

Select the dropdown on the block to choose between the five Pen widths.

The default width is 'thin,' which is the blue line in this example.

Screenshot of VEXcode VR interface highlighting robot features, showcasing block-based and text-based coding options for programming a virtual robot in a simulated environment.

VEXcode VR Python

Select one of the following five values for the VR Pen width.

  • EXTRA_THIN
  • THIN
  • MEDIUM
  • WIDE
  • EXTRA_WIDE

The default width is 'thin,' which is the blue line in this example.


Fill Area With Color

Screenshot of VEXcode VR interface showcasing robot features, including a virtual robot model, coding blocks, and programming options for users to learn coding concepts in a simulated environment.

The Fill area with color command uses the VR Pen to fill an area of the Playground with a specified color.

Screenshot of the VEXcode VR interface showcasing various robot features, including block-based coding options, a virtual robot, and tools for testing and debugging code in a simulated environment for educational purposes.

VEXcode VR Blocks

Using the sliders, select the red, green, and blue values for the fill color you want to create. The numeric value will be listed next to the color (0 to 255).

Opacity describes the transparency of the color. The opacity of the fill color can be selected using the bottom slider.

The color window will update to show the fill color on the Playground. In this example, the pen would fill the Playground with a teal color.

Note that the Pen does not have to be set to 'down' in order to use the [Fill area with color] block.

Screenshot of VEXcode VR interface showcasing robot features, including a virtual robot and coding options, designed for teaching coding concepts and robotics principles in an educational setting.

VEXcode VR Python

The color of the fill is specified with rgb values (red, green, blue) and opacity.

Each parameter (red, green, and blue) defines the intensity of the color as an integer between 0 and 255.

The opacity describes the transparency of the color. Opacity is set using a value from 0 to 100 percent. This command will default to 100 percent for the opacity.

Note that the Pen does not have to be set to 'DOWN' in order to use the fill command.

Screenshot of VEXcode VR interface showcasing robot features, including block-based coding options and a virtual robot in a simulated environment, designed to aid learning in coding and robotics for students and educators.

The Fill area with color command can also be used with different images on the Playground canvas to color in separate areas with different colors. 

All of the examples here have been shown on the Art Canvas+ Playground. For more information on using the Playground Window in Art Canvas+, view this article

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: