Console#
Introduction#
All Console blocks will appear in the VEXcode AIR Console. To view the Console, the Console Serial Port must be connected. Console blocks allow you to display text, receive input, and format printed data in real time in VEXcode AIR.
Below is a list of the available blocks:
print on console — Displays text at the current cursor position.
set cursor to next row on console — Moves the cursor to the next row.
clear console — Clears all text from the Console.
ask and wait & answer — Prompts the user for input, then waits for a response to be entered in the Console. The input can be used in the project.
set print precision on console — Adjusts numeric formatting for printed numbers.
set font color on console — Changes the color of printed text.
print on console#
The print on console block displays text in the Console with the current font color.
print [VEXcode] on console ▶
Parameters |
Description |
---|---|
value |
The text, number, or variable value to display in the Console. |
expanding arrow |
Expand the block to say and set cursor to next row and make the cursor move to the next row after this block. |
Example
when started :: hat events
[Display a message in the Console.]
print [Hello, Drone!] on console ▶
set cursor to next row on console#
The set cursor to next row on console block moves the cursor to the next row in the Console.
set cursor to next row on console
Parameters |
Description |
---|---|
This block has no parameters. |
Example
when started :: hat events
[Display two lines of text.]
print [Line 1] on console ▶
set cursor to next row on console
print [Line 2] on console ▶
clear console#
The clear console block clears the Console of all text.
clear console
Parameters |
Description |
---|---|
This block has no parameters. |
Example
when started :: hat events
[Clear a Console message after 2 seconds.]
print [VEXcode!] on console ▶
wait [2] seconds
clear console
ask and wait & answer#
The ask and wait and answer blocks are used together to prompt for an input from the Console and then use the input in a project.
ask [What's your name?] and wait
answer
The ask and wait block has one parameter:
Parameter |
Description |
---|---|
prompt |
The prompt to display in the controller’s Console. |
The answer block has no parameters.
Example
when started :: hat events
[Tell VEXcode your name.]
ask [What's your name?] and wait
print [Hello, ] on console ▶
print (answer) on console ▶
set print precision on console#
The set print precision on console block sets the precision formatting used for displaying numbers in the Console. This print precision will apply to all subsequently printed numbers.
set print precision to [0.1 v] on console
Parameters |
Description |
---|---|
precision |
Sets the print precision to:
|
Example
when started :: hat events
[Print 1/3 as 0.33.]
set print precision to [0.01 v] on console
print ([1] [math_division v] [3]) on console ▶
set font color on console#
The set font color on console block changes the color of text displayed in the Console. This affects all future printed text until the color is changed again.
set font color to [red v] on console
Parameter |
Description |
---|---|
color |
The color to set:
|
Example
when started :: hat events
[Display a green message.]
set font color to [green v] on console
print [I am green!] on console ▶