Once a VEX project is programmed in VS Code, users need to build and download it onto a VEX device, and then run the project to enable the VEX Robot to execute the program developed in VS Code.
How to build a VEX Project in VS Code
Building a VEX Project ensures the correctness of the program's syntax and prepares the code for downloading and running on the specific VEX platform.
-
(Optional) Select the VEX project for the VEX Extension to build when multiple VEX projects exist inside the workspace.
Note: VS Code supports multiple workspace projects.- Click on the Project Selector Icon on the Toolbar.
Note: The Project Selector displays the name of the selected project.
- A Quick Pick List will prompt with all the valid VEX projects inside the workspace. Click on the list item of the VEX project that you want the VEX Extension to build.
Note: A valid VEX project is a project that is created or imported by the VEX Extension. VEXcode or VEXcode Pro projects opened in the editor will not be considered a valid VEX Project and will need to be imported.
- Click on the Project Selector Icon on the Toolbar.
-
(Optional) Select the Python file as the source code for the VEX Extension to build when a Python Project is selected and there are multiple Python files located in the workspace directory.
Note: The VEX Extension only supports single Python file downloads currently.- Click on the Python File Selector Icon on the Toolbar.
Note: The Python File Selector Icon will appear on the Toolbar only when a VEX Python project is selected. It displays the name of the selected Python file.
- A Quick Pick List will prompt with all Python files located in the workspace directory. Click on the list item of the Python File to choose it as the source code you want the VEX Extension to build.
- Click on the Python File Selector Icon on the Toolbar.
- Click on the Build Icon on the Toolbar to build (compile) the project.
Note: The Build Icon will appear on the Toolbar when there is no VEX device connected to the computer.
How to download a VEX Project in VS Code
- Connect the VEX Brain to the computer using a Micro-USB cable (VEX V5 Brain) or a USB-C cable (VEX EXP Brain and IQ 2nd Brain) and power on the VEX Brain.
- (Optional) Select the VEX device for the VEX Extension to connect when multiple VEX devices are connected to the computer.
- Click the Device Picker Icon on the Toolbar.
Note: The Device Picker will appear on the Toolbar only when a VEX device is connected to the computer. It displays the Icon representing the connected VEX device type (a Brain or a Controller) and the Brain name.
Note: If a VEX Controller is connected to the computer but does not have a radio link to a VEX Brain, no Brain name will be displayed next to the Controller Icon.
- A Quick Pick List will prompt with all the VEX devices connected to the computer. Click on the list item of the VEX device that you want the VEX Extension to connect.
- Select the Slot the VEX project will be downloaded to on the VEX Brain.
Note: The VEX Brain has eight Slots to store downloaded programs. Users can choose which Slot to use by selecting the Slot within VS Code. Keep in mind that downloading will replace the previous program using the selected Slot. - Click on the Slot Selector Icon on the Toolbar.
- A Quick Pick List will prompt with the available user program Slots 1-8. Click on the list item of the Slot that you want the VEX project to be downloaded to on the VEX Brain.
- Click on the Download Icon on the Toolbar to build the VEX project, and if successful, download the project to the VEX Brain.
Note: When the VEX device is connected to the computer, the Build Icon on the Toolbar changes to the Download Icon.
How to run and stop a VEX Project in VS Code
When the VEX project is downloaded to a VEX Brain and the Vex Brain is still plugged into the computer, users can run the project or stop running the project in VS Code.
- Click the Play Icon on the Toolbar To run the user project downloaded to the VEX Brain in the VS Code.
Note: This method for running the VEX project will only work if the VEX Robot is still plugged into the computer and is planned to remain stationary.
- Click the Stop Icon on the Toolbar to stop running the user program on the VEX Brain.
Note: This method will only work if the VEX Robot is still plugged into the computer.
It is advised to run and stop the VEX project from the VEX Robot Brain while unplugged from the computer if the robot is supposed to drive. For helpful information about running user programs with the VEX Brain, please check out this article for the VEX V5 Brain, this article for the VEX EXP Brain, and this article for the VEX IQ (2nd) Brain.