Screen#

Introduction#

The Screen category includes blocks that allow your IQ (2nd gen) Brain’s Screen to display text, values, and graphics on the brain’s built-in screen. These blocks can be used to print sensor data, create custom interfaces, or draw visual elements like lines, shapes, and text with adjustable styles and colors.

Below is a list of all blocks:

Print — Display text and values on the brain.

Settings — Configure screen display properties.

Draw — Create shapes and graphics on the brain’s screen.

Print#

print#

The print block displays text on the brain’s screen at the current cursor position and font.

    print [VEXcode] on screen ▶

Parameters

Description

value

The text, number, or variable value to display.

expanding arrow

Expand the block to read and set cursor to next row to make the cursor move to the next row after this block.

Example

    when started
    [Display a message at the starting cursor position.]
    print [Hello, Robot!] on screen ◀ and set cursor to next row

A screenshot of the VEX IQ Brain screen reads Hello, Robot! in white text on the first line.

set cursor to row column#

When using the set cursor to row column block, the cursor is placed at a specific row and column on the brain’s screen. How many rows and columns can comfortably fit depends on the selected font.

Monospaced fonts have characters that are all the same width, making text placement consistent. In contrast, proportional fonts vary in character width, so some letters take up more space than others. However, regardless of which type is used, the set cursor to row column block positions the cursor based on row and column size, not font style. The font size can be adjusted using the set font block.

Set cursor stack block#
    set cursor to row [1] column [1] on screen

Parameters

Description

row

The row of the cursor as an integer.

column

The column of the cursor as an integer.

Example

    when started
    [Repeatedly print the current timer at Row 1 Column 1]
    forever
    print (timer in seconds) on screen ◀ and set cursor to next row
    wait (1) seconds
    clear screen
    set cursor to row (1) column (1) on screen

A screenshot of the VEX IQ Brain screen reads 25 in white text in the upper left corner.

set cursor to next row#

The set cursor to next row block moves the cursor to column 1 on the next row on the brain’s screen.

    set cursor to next row on screen

Parameters

Description

This block has no parameters.

Example

    when started
    [Display two lines of text.]
    print [Line 1] on screen ▶
    set cursor to next row on screen
    print [Line 2] on screen ◀ and set cursor to next row

A screenshot of the IQ Brain screen reads Line 1 in white text in the upper left corner, and Line 2 directly below it.

clear row#

The clear row block is used to clear a single row on the brain’s screen.

    clear row (1) on screen

Parameters

Description

row

The row number to clear as an integer.

Example

    when started
    [Display text on two rows, but only keep one.]
    print [This text stays] on screen ◀ and set cursor to next row
    print [This disappears] on screen ◀ and set cursor to next row
    wait (3) seconds
    clear row (2) on screen

cursor column#

The cursor column block returns the column number where text will be printed as an integer.

cursor column reporter block#
    (cursor column)

Parameters

Description

This block has no parameters.

Example

When started, moves the cursor to row 3, column 2 on the screen and prints the current cursor column number.#
    when started
    [Display the cursor's current column.]
    set cursor to row [3] column [2] on screen
    print (cursor column) on screen ▶

cursor row#

The cursor row block returns the row number where text will be printed as an integer.

cursor row reporter block#
    (cursor row)

Parameters

Description

This block has no parameters.

Example

When started, moves the cursor to row 6, column 2 on the screen and prints the current cursor row number.#
    when started
    [Display the cursor's current row.]
    set cursor to row [3] column [2] on screen
    print (cursor row) on screen ▶

Settings#

clear screen#

The clear screen block clears all text and drawings from the brain’s screen.

    clear screen

Parameters

Description

This block has no parameters.

Example

    when started
    [Fill the screen, then clear it after 2 seconds.]
    repeat (5)
    print [Line] on screen ◀ and set cursor to next row
    end
    wait (3) seconds
    clear screen

set font#

The set font block sets the font and size used for displaying text on the brain’s screen. This font will apply to all subsequently printed text.

    set font to [monospaced v] [medium v] on screen

Parameters

Description

font

The font to use:

  • monospaced
  • proportional

size

The size to use:

  • extra small
  • small
  • medium
  • large
  • extra large
  • super large

A screenshot of the VEX IQ Brain screen with a series of numbers and letters in Mono 12 font. The letter A-Z are on one line, spanning the width of the screen. The lower left corner indicates 26 characters across and 9 rows.
Mono Extra Small

The same screenshot as the one previous, now with Mono 15 font. The letters A-T are on one line, spanning the width of the screen. The lower left corner indicates 20 characters across and 7 rows.
Mono Small

The same screenshot as the one previous, now with Mono 20 font. The letters A-P are on one line, spanning the width of the screen. The lower left corner indicates 16 characters across and 5 rows.
Mono Medium

The same screenshot as the one previous, now with Mono 30 font. The numbers 1 through 9 and an extra 0 are on one line, spanning the width of the screen. The lower left corner indicates 3 rows.
Mono Large

The same screenshot as the one previous, now with Mono 40 font. The numbers 1 through 8 are on the second line, spanning the width of the screen.
Mono Extra Large

The same screenshot as the one previous, now with Mono 60 font. The screen shows MN 60 in large font, taking up nearly the whole top half of the screen.
Mono Super Large

The same screenshot as the one previous, now with Prop 20 font. The letters A-W are on one line, spanning the width of the screen. The lower left corner indicates 26 characters across and 5 rows.
Prop Medium

The same screenshot as the one previous, now with Prop 30 font. The numbers 1-9 are repeated twice on one line, spanning the width of the screen. The lower left corner indicates 18 characters across and 3 rows.
Prop Large

The same screenshot as the one previous, now with Prop 40 font. The screen reads Prop 40 on the top line and 14 by 2 on the second.
Prop Extra Large

The same screenshot as the one previous, now with Prop 60 font. The screen reads PROP 60 in large font, taking up nearly the whole top half of the screen.
Prop Super Large

Example

    when started
    [Display two different fonts on separate lines.]
    set font to [monospaced v] [medium v] on screen
    print [Mono Medium] on screen ◀ and set cursor to next row
    set font to [proportional v] [medium v] on screen
    print [Prop Medium] on screen ◀ and set cursor to next row

A screenshot of the IQ Brain screen with white text on two lines in the upper left corner. The first line reads Mono Medium and the second line directly below reads Prop Medium in a smaller font.

set print precision on screen#

The set print precision on screen block sets the precision formatting used for displaying numbers on the brain’s screen. This print precision will apply to all subsequently printed numbers.

    set print precision to [0.1 v] on screen

Parameters

Description

precision

Sets the print precision to:

  • 1
  • 0.1
  • 0.01
  • 0.001
  • All Digits

Example

    when started
    [Print 1/3 as 0.33.]
    set print precision to [0.01 v] on screen
    print ([1] / [3]) on screen ◀ and set cursor to next row

A screenshot of the IQ Brain screen with white text reading 0.33 in the upper left corner.

set pen width#

The set pen width block sets the pen width used for drawing lines and shapes.

    set pen width to [10] on screen

Parameters

Description

width

The pen width in pixels in a range from 0 to 32.

Example

    when started
    [Draw two circles with different pen widths.]
    draw circle (40) (70) (20) on screen
    set pen width to (5) on screen
    draw circle (100) (70) (20) on screen

A screenshot of the IQ Brain screen with two white circles printed on the lower half of the screen. The circle on the left is drawn with a narrower border than the one the right.

set pen color#

The set pen color block sets the pen color used for drawing lines, shapes, and text on the brain’s screen.

    set pen / font color to [red v] on screen

Parameters

Description

color

Sets the pen color to:

  • red
  • green
  • blue
  • white
  • yellow
  • orange
  • purple
  • red violet
  • violet
  • blue violet
  • blue green
  • yellow green
  • yellow orange
  • red orange

Example

    when started
    [Draw two rectangles with different colors.]
    draw rectangle (100) (50) (10) (20) on screen
    set pen / font color to [blue v] on screen
    draw rectangle (50) (50) (10) (20) on screen

A screenshot of the IQ Brain screen with two small rectangles drawn on the lower half of the screen. The rectangle on the left is blue, and the one on the right is white.

set fill color#

The set fill color block sets the fill color used when shapes are drawn.

    set fill color to [red v] on screen

Parameters

Description

color

Sets the fill color to:

  • red
  • green
  • blue
  • white
  • yellow
  • orange
  • purple
  • red violet
  • violet
  • blue violet
  • blue green
  • yellow green
  • yellow orange
  • red orange

Example

    when started
    [Draw a yellow circle.]
    set fill color to [yellow v] on screen
    draw circle (50) (50) (20) on screen

A screenshot of the IQ Brain screen with a bright yellow circle with a thin white border drawn on the left half of the screen.

Draw#

draw pixel#

The draw pixel block draws a pixel at the specified (x, y) screen coordinate in the current pen color.

    draw pixel [0] [0] on screen

Parameters

Description

x

The x-coordinate to draw the pixel.

y

The y-coordinate to draw the pixel.

Example

    when started
    [Draw one pixel at the center of the screen.]
    draw pixel (80) (50) on screen

A screenshot of the IQ Brain screen with a tiny white dot in the center of the screen.

draw line#

The draw line block draws a line from the first specified screen coordinate (x1, y1) to the second specified screen coordinate (x2, y2) using the current pen width and pen color.

    draw line [0] [0] [159] [107] on screen

Parameters

Description

x1

The x-coordinate in pixels of the start of the line.

y1

The y-coordinate in pixels of the start of the line.

x2

The x-coordinate in pixels of the end of the line.

y2

The y-coordinate in pixels of the end of the line.

Example

    when started
    [Draw a line from the top left to bottom right of the screen.]
    draw line (0) (0) (159) (107) on screen

A screenshot of the IQ Brain screen with a white diagonal line drawn from the upper left corner to the lower right corner.

draw rectangle#

The draw rectangle block draws a rectangle using the current pen width, pen color, and fill colors.

    draw rectangle [0] [0] [10] [10] on screen

Parameters

Description

x

The x-coordinate in pixels of the top-left corner of the rectangle.

y

The y-coordinate in pixels of the top-left corner of the rectangle.

width

The width of the rectangle in pixels.

height

The height of the rectangle in pixels.

Example

    when started
    [Draw a rectangle on the screen.]
    draw rectangle (25) (25) (100) (50) on screen

A screenshot of the IQ Brain screen with a large white rectangle drawn nearly centered on the screen.

draw circle#

The draw circle block draws a circle using the current pen width, pen color, and fill colors.

    draw circle [0] [0] [10] on screen

Parameters

Description

x

The x-coordinate in pixels of the center of the circle.

y

The y-coordinate in pixels of the center of the circle.

radius

The radius of the circle in pixels.

Example

    when started
    [Draw a circle on the screen.]
    draw circle (80) (50) (20) on screen

A screenshot of the IQ Brain screen with a white circle drawn centered on the screen.