Looks#

Print#

Print#

The Print block is used to print values or text in the Print Console or VEX IQ Brain’s screen.

a VEXcode blocks stack of code containing a print block with the string Hello#
  print [Hello] ▶

All reporter blocks will be printed as integer (whole) numbers by default. Use the Set Print Precision block to adjust the number of decimal places printed.

All new projects begin with the screen cursor at row 1 column 1, and at row 1 on the Print Console.

By default, the Print block will remain on the same row for any subsequent print commands. By expanding the Print block to show and set cursor to next row, this will move the cursor to the next row after printing.

Important: The Print block will not print anything to the Brain screen unless it is expanded to and set cursor to next row or followed by a Next Row block.

a VEXcode blocks stack of code containing a print block with the string hello and sets the cursor to the next row#
  print [Hello] ◀ and set cursor to next row

Any block that returns a value can be used in the Print block.

In this example, the robot’s current rotation will be printed to the IQ Brain.

a VEXcode blocks stack of code containing a when started block and a print block that sets the cursor to the next row#
    when started :: hat events
    print (drive rotation in degrees) on [Brain v] ◀ and set cursor to next row

Set Cursor#

The Set Cursor block is used to set the cursor location for Print blocks on the IQ (1st gen) Brain’s screen or Controller’s screen.

a VEXcode block stack of code with a set cursor block that sets to row 1 column 1 on brain#
  set cursor to row (1) column (1) on Brain :: #9A67FF

The Set Cursor block accepts a range for row of 1 to 5 and a range for column of 1 to 21.

In this example, the robot will print the current timer value on the Brain, clear the value, and reset back to the first column and row before printing again.

A VEXcode blocks stack that has a “when started” hat block connected to a “forever” C-block that contains a comment block, a “print (timer in seconds) on Brain” block, another comment block, a “wait (1) seconds” block, a “clear all rows on Brain” block, and a “set cursor to row (1) column (1) on Brain” block.#
  when started :: hat events
  forever
  [Print the current timer on the Brain.]
  print (timer in seconds) on [Brain v] ◀ and set cursor to next row
  [After 1 second, clear the value and reset the cursor.]
  wait (1) seconds
  clear all rows on [Brain v]
  set cursor to row (1) column (1) on Brain :: #9A67FF

Next Row#

The Next Row block is used to set the print output cursor on the Print Console, IQ (1st gen) Brain’s screen, or Controller’s screen to the next available row.

a VEXcode stack of blocks that has a set cursor to next row block#
  set cursor to next row on [Brain v]

By default, all projects begin with the screen cursor at row 1 column 1. The Next Row block will move the cursor down by a single row on the screen. The Next Row block will also set the cursor’s column to position 1.

In this example, the robot will print “Hello” on the 1st row and “world!” on the 2nd row.

A VEXcode stack of blocks containing a “when started” hat block followed by a “print [Hello] on Brain” block, a “set cursor to next row on Brain” block, and then a “print [world!] on Brain” block that also sets the cursor to the next row.#
  when started :: hat events
  print [Hello] on [Brain v] ▶
  set cursor to next row on [Brain v]
  print [world!] on [Brain v] ◀ and set cursor to next row

Set Print Precision#

The Set Print Precision block is used to set the number of digits that appear after the decimal point when printing reporter blocks on the Print Console or IQ (1st gen) Brain’s screen.

A VEXcode stack of blocks containing a set print precision block and sets the value to 0.1#
  set print precision to [0.1 v]

Choose the level of precision that inserted reporter blocks will be printed to the screen.

  • Ones (1) (Default)

  • Tenths (0.1)

  • Hundredths (0.01)

  • Thousandths (0.001)

  • All Digits (0.000001)

A notched purple coding block with the text "set print precision to" followed by a dropdown menu showing the value "0.1." Below the block, an expanded dropdown menu displays options: 1, 0.1 (with a checkmark), 0.01, 0.001, and "All Digits.

In this example, the print precision is set to hundredths before printing the current drivetrain heading.

a VEXcode stack of code blocks containing a “when started” hat block, followed by a “set print precision to [0.1] on Brain” block, and then a “print (drive heading in degrees) on Brain” block that also sets the cursor to the next row.#
  when started :: hat events
  set print precision to [0.1 v] on [Brain v]
  print (drive heading in degrees) on [Brain v] ◀ and set cursor to next row

Clear All Rows#

The Clear All Rows block is used to clear the entire IQ (1st gen) Brain’s screen.

a VEXcode blocks stack of code containing a clear all rows on Brain block#
  clear all rows on[Brain v]

In this example, the robot will print the current timer value on the Brain, clear the value, and reset back to the first column and row before printing again.

a VEXcode blocks stack of code containing a “when started” hat block, followed by a “forever” C-block that contains a comment block, a “print (timer in seconds) on Brain” block (which sets the cursor to the next row), another comment block, a “wait (1) seconds” block, a “clear all rows on Brain” block, and finally a “set cursor to row (1) column (1) on Brain” block.#
  when started :: hat events
  forever
  [Print the current timer on the Brain.]
  print (timer in seconds) on [Brain v] ◀ and set cursor to next row
  [After 1 second, clear the value and reset the cursor.]
  wait (1) seconds
  clear all rows on [Brain v]
  set cursor to row (1) column (1) on Brain :: #9A67FF
  end

Clear Row#

The Clear Row block is used to clear a single row on the IQ (1st gen) Brain’s screen.

a VEXcode blocks stack of code containing a clear row block thats clears the first row on the brain.#
  clear row (1) on Brain :: #9A67FF

In this example, the robot will print “VEXcode” on three different rows before deleting the “VEXcode” in the 2nd row.

A VEXcode blocks stack of code containing a “when started” hat block, followed by a comment block, a “repeat (3)” C-block containing a “print [VEXcode] on Brain” block (which sets the cursor to the next row), another comment block, a “wait (1) seconds” block, and finally a “clear row (2) on Brain” block.#
  when started :: hat events
  [Print "VEXcode" on the 1st, 2nd, and 3rd rows.]
  repeat (3)
  print [VEXcode] on [Brain v] ◀ and set cursor to next row
  end
  [Wait 1 second before clearing the 2nd row.]
  wait (1) seconds
  clear row (2) on Brain :: #9A67FF

Touch LED#

Set Touch LED Color#

The Set Touch LED Color block is used to set the color of the VEX IQ Touch LED.

a VEXcode stack of code blocks containing a set TouchLED11 color block that has a dropdown that currently is set to none#
    set [TouchLED11 v] color to (none v)

Select which Touch LED device to use.

A notched purple coding block with a yellow highlight around it containing the text "set TouchLED11 color to none" written in white. There are two dropdown menus: one labeled "TouchLED11" and the other labeled "none." Below the block, an expanded dropdown menu shows the option "TouchLED11" with a checkmark next to it.

Select which color to display.

A notched purple coding block with a yellow highlight around it containing the text "set TouchLED11 color to none" written in white. There are two dropdown menus: one labeled "TouchLED11" and the other labeled "none." Above the block, an expanded dropdown menu shows various color options, including "none" (with a checkmark), "red," "green," "blue," "white," "yellow," "orange," "purple," "red violet," "violet," and "blue violet.

You can also set the color of the Touch LED to the color detected by the Color Sensor or Optical Sensor using the Color Sensor Color Name or Optical Sensor Color Name block.

a VEXcode stack of code blocks containing a set color to block that sets the color on the TouchLED#
    set [TouchLED11 v] color to ([Color12 v] color name)
a VEXcode stack of code blocks containing a set color to block that sets the color on the TouchLED based on the optical4 color#
    set [TouchLED11 v] color to ([Optical4 v] color name)

In this example, the Touch LED will be set to green at the start of the project, then turn off after 2 seconds.

a VEXcode stack of blocks containing a “when started” hat block followed by a “set [TouchLED11 v] color to (green v)” block, a “wait (2) seconds” block, and a “set [TouchLED11 v] color to (none v)” block.#
    when started :: hat events
    set [TouchLED11 v] color to (green v)
    wait (2) seconds
    set [TouchLED11 v] color to (none v)

Set Touch LED Fade#

The Set Touch LED Fade block is used to set how fast the color of the VEX IQ Touch LED fades between colors.

a VEXcode stack of code blocks containing a set fade to block that sets the touchLED fade to slow#
    set [TouchLED11 v] fade to [slow v]

Choose which Touch LED to use.

A notched purple coding block with a yellow highlight around it containing the text "set TouchLED11 fade to slow" written in white. There are two dropdown menus: one labeled "TouchLED11" and the other labeled "slow." Below the block, an expanded dropdown menu shows the option "TouchLED11" with a checkmark next to it.

Choose how fast a color on the Touch LED will fade when swapped to a new color.

  • slow - The Touch LED will slowly fade to a new color.

  • fast - The Touch LED will quickly fade to a new color.

  • off - The Touch LED’s color will change instantly.

A notched purple coding block with a yellow highlight around it containing the text "set TouchLED11 fade to slow" written in white. There are two dropdown menus: one labeled "TouchLED11" and the other labeled "slow." Below the block, an expanded dropdown menu shows the options "slow" (with a checkmark), "fast," and "off.

In this example, the Touch LED will be set to green and the fade will be set to slow at the start of the project, then the Touch LED will change to red after two seconds.

a VEXcode stack of code blocks with a “when started” hat block that sets [TouchLED11 v] to green, sets its fade to slow, waits 2 seconds, then changes the color to red.#
    when started :: hat events
    set [TouchLED11 v] color to (green v)
    set [TouchLED11 v] fade to [slow v]
    wait (2) seconds
    set [TouchLED11 v] color to (red v)

Set Touch LED Brightness#

The Set Touch LED Brightness block is used to set the brightness level of the VEX IQ Touch LED.

a VEXcode stack of code blocks with a set brightness block that sets the brightness of the TouchLED11 to 50%#
    set [TouchLED11 v] brightness to (50) %

Choose which Touch LED to use.

A notched purple coding block with a yellow highlight around it containing the text "set TouchLED11 brightness to 50%" written in white. There are two elements: a dropdown menu labeled "TouchLED11" and the number "50" displayed in a white oval, representing the brightness level. The "%" symbol follows the number. Below the block, an expanded dropdown menu shows the option "TouchLED11" with a checkmark next to it.

In this example, the Touch LED will turn green at 25% brightness, then after 2 seconds, the brightness will be set to 100%.

a VEXcode stack of code blocks that contains a “when started” hat block that sets [TouchLED11 v] brightness to 25%, sets its color to green, waits 2 seconds, then sets the brightness to 100%.#
    when started :: hat events
    set [TouchLED11 v] brightness to (25) %
    set [TouchLED11 v] color to (green v)
    wait (2) seconds
    set [TouchLED11 v] brightness to (100) %

Color#

Set Color Sensor Light#

The Set Color Sensor Light block is used to set the brightness of the VEX IQ Color Sensor’s light.

a VEXcode stack of code blocks that contains a set light to block that sets the color12 to 50%#
    set [Color12 v] light to (50) %

Choose which Color Sensor to use.

A notched purple coding block with a yellow highlight around it containing the text "set Color12 light to 50%" written in white. There are two elements: a dropdown menu labeled "Color12" and the number "50" displayed in a white oval, representing the light level. The "%" symbol follows the number. Below the block, an expanded dropdown menu shows the option "Color12" with a checkmark next to it.

In this example, the Color Sensor will start at 25% brightness, then after 2 seconds, the brightness will be set to 100%.

a VEXcode stack of code blocks containing a “when started” hat block that sets [Color12 v] light to 25%, waits 2 seconds, and then sets it to 100%.#
    when started :: hat events
    set [Color12 v] light to (25) %
    wait (2) seconds
    set [Color12 v] light to (100) %