Using Examples and Templates#

Using Examples and Templates

This tutorial walks you through opening an example project and a pre-made template in VEXcode IQ (2nd gen). By the end, you’ll have an example project open, and know how to load a template for your robot build.

Example projects are a great resource to explore different robot behaviors or how different blocks in VEXcode are used. Templates are blank projects with devices already configured, so if you’re using a robot build from builds.vex.com, you won’t need to configure the devices yourself.

  1. Select File in the top-left of VEXcode, then select Open Examples.

Screenshot of the File menu open, with the Open Examples option highlighted.

Opening the Examples page will open a new project, so be sure to save any unsaved work in your current project first. If your project hasn’t been saved yet, select Save to save it before continuing.

Screenshot of the Unsaved Project Detected dialog, with the Save button highlighted.
  1. The Open Examples page shows all the available example projects.

Screenshot of the Open Examples page, showing the Project Language options and a grid of example projects with category filters.
  1. Select one of the filters to narrow down the example projects shown, such as Drivetrain to only show example projects demonstrating how to code a Drivetrain.

Screenshot of the Open Examples page, with the Drivetrain filter highlighted and its matching example projects shown.

You can also use the search bar to search for the name of an example project.

Screenshot of the Open Examples page, with the search bar highlighted.
  1. Select an example project, then select Save and Create Project to save the new project to your device.

Screenshot of the Open Example Project screen, with the Project Name field and the Save and Create Project button highlighted.
  1. The project will open in VEXcode with code demonstrating the example already in the workspace. The robot will already be configured in the Devices menu, and a note in the workspace will explain what the project does and what device configuration to use with it.

Screenshot of an opened example project in VEXcode, showing the example's blocks in the workspace and a comment explaining the project.

You can also use a template instead of an example project:

  1. Go to the Devices tab, then select Select a build. If the Devices tab is not visible, see Navigating VEXcode.

Screenshot of the Devices tab, showing the Select a build button.
  1. Select the robot build you are using.

Screenshot of the Select a build screen, showing a grid of available robot builds.
  1. If your build has different versions, select which version you’re using.

Screenshot of the Select a build screen, showing the Without Sensors and With Sensors variant options for the BaseBot build.
  1. VEXcode will show you all of the devices used with the build and what ports they’re connected to. Select Done to add this configuration to your project.

Screenshot of the Current Configuration screen, showing the build's devices and the Done button highlighted.
  1. Those devices will now appear, configured in the Devices menu, ready to code with.

Screenshot of the Devices tab, showing the Drivetrain, TouchLED2, Optical3, Distance7, and Bumper8 devices added from the build.