Using the Print Console in VEXcode EXP with Python

The Print Console allows the user to display messages, report sensor values, or to present data from VEXcode EXP projects. The Print Console also allows users to save print outputs as a text file.

The Print Console can also be used to display process information, providing visual cues that enable the user to see what is happening in a VEXcode EXP project at a specific moment in time, thereby making a visual connection between the project and the actions of the EXP Robot.

The Print Console needs to have active communication between the VEX EXP Brain and the device being used with VEXcode EXP. This can be accomplished by:

USB Connection

Screen_Shot_2022-01-05_at_12.54.49_PM.png

Wireless Via Controller

vlcsnap-2022-02-09-15h24m49s736.png

Note: Bluetooth communication is unavailable.


How to Open the Print Console

Screen_Shot_2022-02-08_at_3.23.26_PM.png

The Print Console is located in the EXP Monitor Display. To open the Print Console, select the Monitor Display icon next to Help.

Screen_Shot_2022-02-08_at_3.25.18_PM.png

The Monitor Display will open once selected. The Print Console is at the right side.


How to Use the Print Console in a Project

Commands that Trigger the Print Console

print_console_commands.png

Print commands are located in the Look category of commands and are used in a VEXcode EXP project in order to trigger the Print Console.

These commands print words, numbers, reported values from variables, values reported from a sensor or device, or clear the console.

The Help feature in VEXcode EXP provides additional information on these and other commands.

See this article for information on how to access the Help feature.

Using Print Commands with the Print Console

python_code_for_print_example.png

Use print commands in a VEXcode EXP project to print a message, or display data in the Print Console.

To use the print commands, select the command and add it to a project.

Then, type the text to be printed inside the quotation marks within the parentheses.

Note: You can also add sensor or variable commands inside the parenthesis to print data. See examples in the 'Examples using the Print Console' section. 

Screen_Shot_2022-02-08_at_3.29.56_PM.png

Download the project to the EXP Robot Brain and Select "Run". See this article on downloading and running a Python project. 

Screen_Shot_2022-02-08_at_4.10.18_PM.png

Once “Run” is selected, the project will run and the colored text or programmed values will be printed to the Print Console as dictated by the VEXcode EXP project.

Note: Python creates a new line by default after each print command.

Screen_Shot_2022-02-08_at_4.17.37_PM.png

You can print multiple values on a single line by adding multiple messages or commands inside the parentheses of the print command, and separating them with commas as shown on the image on the left.

Screen_Shot_2022-02-08_at_4.21.02_PM.png

Or, you can utilize the end parameter to print multiple values to a single line, as shown in this image.


Printing in Color in the Print Console

Screen_Shot_2021-11-17_at_12.05.42_PM.png

You can set the color of the text being printed by using a color code with a print command in VEXcode EXP.

To use a color code with a print command, add the escape sequence ("\033") and the color code inside the print command, as shown on the left.

The following are a few examples of color codes.

  • [31m - Red
  • [32m - Green
  • [34m - Blue

See the complete list of color codes in the Help Feature for the print command. See this article for information on how to access the Help feature.

Screen_Shot_2022-02-08_at_3.29.56_PM.png

Download the project to the EXP Robot Brain and Select "Run". See this article on downloading and running a Python project. 

Screen_Shot_2022-02-08_at_4.30.03_PM.png

Once “Run” is selected, the project will run and the colored text or programmed values will be printed to the Print Console as dictated by the VEXcode EXP project.


Clear Rows in the Print Console

Screen_Shot_2022-02-09_at_9.45.43_AM.png

There are two ways to clear all information from the Print Console. The first way to completely clear all text is to select the “Clear” button on the bottom left of the Print Console.

Screen_Shot_2021-11-16_at_11.58.34_AM.png

Another way to clear the Print Console is to use the Console Clear print command highlighted in the image on the left. Add this command to remove all of the lines in the Print Console.

In this project, “Hello” will print on the Print Console. After 3 seconds, the console will be cleared.


Save from the Print Console

Screen_Shot_2022-02-09_at_10.07.00_AM.png

It is easy to save information from the Print Console onto your device.

Select “Save” on the bottom of the Print Console to save all text as a .txt file.

downloaded_logs.png

Once you select the “Save” button, the file will automatically save to the Downloads folder on your device as a .txt file.

Note: The file does not save printed colors.


Example Projects Using the Print Console

Report Variable Values and Data in a Project

The Print Console can be used to report variable values at discrete moments within a project.

Screen_Shot_2021-11-17_at_11.18.54_AM.png
Screen_Shot_2021-11-17_at_11.20.19_AM.png

Use the Print Console to print the value of “myVariable."

In the project on the left, the Print Console displays variable values when the Brain buttons are pressed. The variable increases when the 'left' button is pressed, and decreases when the 'right' button is pressed.


Report Sensing Values and Data in a Project

The Print Console can be used to report sensor data at discrete moments within a project.

python_project.png
python._sensor_project.png

The data captured by the Print Console allows the user to see valuable information about project processes including EXP Robot sensor information. When the print command is triggered, it can be programmed to display information captured in the moment.

In the project on the left, the Print Console displays information reported by the Inertial Sensor built into the EXP Brain as prescribed by the Look and Sensing commands within the project. This information includes changes that the Inertial Sensor captures at discrete moments while the project is running: time in seconds and the rotation of the EXP BaseBot in degrees.

Note: The project in this example uses the BaseBot (Drivetrain, 2-motor) template.

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

Last Updated: