Starting, Downloading, and Running a Python Project in VEXcode IQ

Starting and downloading Python projects in VEXcode IQ is easy.


How to Start a Python Project

blocks_interface.png

Launch VEXcode IQ. The platform defaults to the Blocks interface.

new_text_project.png

Select ‘File,’ then ‘New Text Project’ to open the text interface.

select_language.png

Next, select the Python project language. There is the option to start a new project in either C++ or Python.

Note: Currently, only IQ (2nd gen) electronics are compatible with Python projects.

python_interface.png

The Python interface will open.


How to Build a Python Project

This section will show you how to create a basic Python project using commands from the Tool Box. The project outlined here will drive the IQ (2nd gen) BaseBot forward for 200 millimeters (mm).

open_examples.png

Select ‘File’ then ‘Open Examples” to open a template project.

Basebot__Drivetrain_2-motor__Example_Project_with_name-noTag.png

Select the Basebot (Drivetrain 2-motor) template. Templates are blank projects with preset device configurations.

If_your_prior_project_was_not_saved__you_will.png

If your project was not saved, the 'Save now' window will appear before the Example Project opens in the workspace.

Select 'Save' if you you want to save your previous project, otherwise select 'Discard.'

commands_in_workspace.png

Notice that a set of project comments open in the workspace. You will add commands after the comments.

begin_project_code.png

Select enter at the end of the last line of code (line 46). This should create the next numbered line (line 47). This is where you will start adding code to the project.

drag_in_drive_for_command.png

Now you can add commands from the Toolbox. Select the Drive for command.

drive_for_command.png

Drag the Drive for command into the workspace and place it on the last line of the project (line 47).


How to Download and Run a Python Project

project_name_box.png

First, name and save your Python project. View one of the following articles for detailed information on how to save a VEXcode IQ Python project:

select_brian_slot.png

Then, choose which of the Brain’s slots you will download the project to. To do this, select the ‘Slot’ button on the Toolbar.

brain_icon.png

Next, connect the Brain to your device (Directly via Micro-USB, USB-C or via VEX Controller. View this section of the Knowledge Base to learn more about connecting an IQ Brain to VEXcode IQ) and check that the Brain icon is green.

download_icon.png

Select the ‘Download’ button to download the project to the Brain. The project will download to the chosen slot.

run_icon.png

Finally, select ‘Run’ to start the project while the robot is still connected to your computer.

Drive_Forward_Program.png

Or, disconnect the Brain from your device and run the project on the IQ Brain.

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