Screen#

Introduction#

The VEX AIR Drone Controller’s screen provides blocks for displaying text, managing the cursor, drawing shapes, and handling touch interactions.

Note: If the VEX AIR Drone is paired with a controller, a timer will be displayed at the top of the print screen indicating the current project’s elapsed time. Any text or drawings will appear behind the timer.

Below is a list of all available blocks, grouped by functionality:

Cursor Print - Manage text display using a row-and-column cursor system.

XY Print - Print text at pixel-based coordinates.

  • print at — Displays text at a specified x and y coordinate.

  • set screen origin — Changes the origin (0, 0) used for drawing and printing.

Settings - Customize text formatting and screen display.

Draw - Create graphics and visual elements.

Touch - Detect screen interactions.

  • screen pressed? — Returns whether the screen is currently being pressed.

  • screen position — Retrieves the x and y coordinates where the screen was last touched.

  • when screen event — Triggers when the screen is pressed or released.

Cursor Print#

print#

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

print stack block#
    print [VEXcode] on screen ▶

Parameters

Description

value

The text, number, or variable value to display on the screen.

expanding arrow

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

Example

When started, displays the message ‘Hello, drone!’ at the starting cursor position on the screen.#
    when started
    [Display a message at the starting cursor position.]
    print [Time to fly!] on screen ▶

A screenshot of the VEX AIR Drone Controller screen, with white text in the upper left corner that reads Time to fly!

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 screen. The amount of characters that can fit on a screen depends on the selected font. The font size can be changed using the set font block. With the default monospaced medium font, up to 18 rows and 53 columns can be displayed clearly. Text placed beyond this range may be cut off or become difficult to read.

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

Parameters

Description

row

The row of the cursor.

column

The column of the cursor.

Examples

When started, moves the cursor to row 7, column 25 on the screen and prints ‘Row 7, Column 25’.#
    when started
    [Display text starting at Row 7 Column 25.]
    set cursor to row [7] column [25] on screen
    print [Row 7, Column 25] on screen ▶

A screenshot of the VEX AIR Drone Controller screen, with white text near the center that reads Row 7, Column 25 in that screen position.

set cursor to next row#

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

set cursor to next row stack block#
    set cursor to next row on screen

Parameters

Description

This block has no parameters.

Example

When started, prints ‘Line 1’ on the screen, moves the cursor to the next row, and then prints ‘Line 2’.#
    when started
    [Display two lines of text.]
    print [Line 1] on screen ▶
    set cursor to next row on screen
    print [Line 2] on screen ▶

A screenshot of the VEX AIR Drone Controller screen, with white text in the upper left corner that reads Line 1 on the top line, and Line 2 directly below it.

clear row#

The clear row block clears a row of text on the controller’s screen.

Clear row stack block#
    clear row [1] on screen

Parameters

Description

row

The row number to clear.

Example

When started, prints text on two rows. The first row remains, while the second row disappears after 3 seconds.#
    when started
    [Clear only the second row of text.]
    print [This text stays] on screen ▶
    set cursor to next row on screen
    print [This text disappears] on screen ▶
    wait [3] seconds
    clear row [2] on screen

screen cursor column#

The screen cursor column returns the cursor’s current column position.

screen cursor column reporter block#
    (screen cursor column)

Parameters

Description

This block has no parameters.

Example

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

A screenshot of the VEX AIR Drone Controller screen, with white text near the center that reads 25, at the row 7, column 25 position.

screen cursor row#

The screen cursor row block returns the cursor’s current row position.

screen cursor row reporter block#
    (screen cursor row)

Parameters

Description

This block has no parameters.

Example

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

A screenshot of the VEX AIR Drone Controller screen, with white text near the center that reads 7, at the row 7, column 25 position.

XY Print#

set screen origin#

The set screen origin sets the origin (0, 0) used for drawing or printing on the controller’s screen. By default, drawing or printing blocks consider the top left corner of the screen as the origin. This block can reset the origin to an alternate (x, y) screen coordinate location.

set screen origin stack block#
    set screen origin x:[0] y:[0]

Parameters

Description

x

The x-coordinate in pixels to set the new origin to.

y

The y-coordinate in pixels to set the new origin to.

Example

When started, sets the screen origin to (320, 240) and draws a rectangle at the new origin with top-left corner at (0,0), width 80 pixels, and height 40 pixels.#
    when started
    [Set the origin to the center of the screen.]
    set screen origin x:[320] y:[240]
    [Draw a rectangle at the new origin.]
    draw rectangle [0] [0] [80] [40] on screen

A screenshot of the VEX AIR Drone Controller screen, with a white rectangle drawn so that the upper left corner is the center of the screen.

Settings#

clear screen#

The clear screen block clears the controller’s screen of all drawings, text, and images.

clear screen block#
    clear screen

Parameters

Description

This block has no parameters.

Example

When started, draws a circle with center (120,120) and radius 40 pixels. After 2 seconds, the screen is cleared.#
    when started
    [Draw a circle, and clear it after 2 seconds.]
    draw circle [320] [240] [80] on screen
    wait [2] seconds
    clear screen

wait for screen to render#

The wait for screen to render block prevents any following screen blocks from displaying and then shows all of their output at once when it is used again.

Note: Using this block changes the project so that all subsequent screen blocks will remain hidden until the wait for screen to render block is used again.

    wait for screen to render

Parameters

Description

This block has no parameters.

Example

When started, draws a circle with center (120,120) and radius 40 pixels. After 2 seconds, the screen is cleared.#
    when started
    [Display text and images when button 7 is pressed.]
    wait for screen to render
    print [Screen rendered!] on screen ▶
    draw circle [320] [240] [80] on screen
    wait until <controller button [7 v] pressed?>
    wait for screen to render

A screenshot of the VEX AIR Drone Controller screen, with white text that reads Screen rendered! in the upper left corner, and a white circle drawn in the center of the screen.

fill screen#

The fill screen block clears the controller’s screen of all drawings and text, then changes the background to a specified color.

The fill screen block#
    fill screen with [red v]

Parameters

Description

color

The color to change the background to:

  • red
  • green
  • blue
  • black
  • white
  • yellow
  • orange
  • purple
  • cyan

Example

    when started
    [Say "Hello" then turn screen green.]
    print [Hello] on screen ▶
    wait [2] seconds
    fill screen with [green v]

A screenshot of the VEX AIR Drone Controller screen, with the entire printable area of the screen filled with bright green.

set font#

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

set font stack block#
    set font to [monospaced v] [medium v] on screen

Parameters

Description

type

The font type:

  • monospaced
  • proportional

size

The font size (shown below):

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

A screenshot of the VEX AIR Drone Controller screen with an assortment of letters and numbers printed in white in the upper left hand corner in Mono 12 font. The letters A-Z are on one line, and take up about a third of the width of the screen. In the lower left corner, it reads 91 characters across and 30 rows.
monospaced super small

The same image as the one previous, now with Mono 15 font. The letters A-Z are on one line, and take up nearly half the width of the screen. In the lower left corner, it reads 71 characters across and 23 rows.
monospaced extra small

The same image as the one previous, now with Mono 20 font. The letters A-Z are on one line, and take up half the width of the screen. In the lower left corner, it reads 53 characters across and 18 rows.
monospaced small

The same image as the one previous, now with Mono 24 font. The letters A-Z are on one line, and take up a little over half the width of the screen. In the lower left corner, it reads 45 characters across and 15 rows.
monospaced medium

The same image as the one previous, now with Mono 30 font. The letters A-Z are on one line, and take up about three quarters of the width of the screen. In the lower left corner, it reads 35 characters across and 12 rows.
monospaced large

The same image as the one previous, now with Mono 40 font. The letters A-Z are on one line, spanning the width of the screen. In the lower left corner, it reads 26 characters across and 9 rows.
monospaced extra large

The same image as the one previous, now with Mono 60 font. The letters A-Q are on one line, spanning the width of the screen. In the lower left corner, it reads 17 characters across and 6 rows.
monospaced super large

The same image as the one previous, now with Prop 20 font. The letters A-Z are on one line, and take up a little over half the width of the screen. In the lower left corner, it reads 49 characters across and 18 rows.
proportional small

The same image as the one previous, now with Prop 24 font. The letters A-Z are on one line, and take up about two thirds of the width of the screen. In the lower left corner, it reads 42 characters across and 15 rows.
proportional medium

The same image as the one previous, now with Prop 30 font. The letters A-Z are on one line, and take up three quarters of the width of the screen. In the lower left corner, it reads 33 characters across and 12 rows.
proportional large

The same image as the one previous, now with Prop 40 font. The letters A-Y are on one line, spanning the width of the screen. In the lower left corner, it reads 24 characters across and 9 rows.
proportional extra large

The same image as the one previous, now with Prop 60 font. The letters A-Q are on one line, spanning the width of the screen. In the lower left corner, it reads 17 characters across and 6 rows.
proportional super large

Example

When started, sets the font to ‘monospaced extra large’ and prints ‘VEX’ on the screen.#
    when started
    [Display text using a larger font.]
    set font to [monospaced v] [extra large v] on screen
    print [VEX] on screen ▶

The same image as those previous, now with white text in the upper left corner that reads VEX is Mono 40 font.

set print precision on screen#

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

set print precision stack block#
    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, sets print precision to two decimal places and prints 1/3 as 0.33 on the screen.#
    when started
    [Print 1/3 as 0.33.]
    set print precision to [0.01 v] on screen
    print ([1] [math_division v] [3]) on screen ▶

A screenshot of the VEX AIR Drone Controller's screen with white text in the upper left corner that reads 0.33.

set pen width#

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

set pen width block#
    set pen width to [10] on screen

Parameters

Description

width

The pen width in pixels.

Example

When started, sets the pen width to 10 pixels and draws a rectangle with the top-left corner at (50,50), width 130 pixels, and height 60 pixels.#
    when started
    [Draw a rectangle with a pen width of 10.]
    set pen width to [10] on screen
    draw rectangle [200] [200] [200] [80] on screen

A screenshot of the VEX AIR Drone Controller's screen with a white rectangle with a thick border printed in the center.

set pen / font color#

The set pen / font color block sets the pen color used for drawing lines, shapes, and text on the controller’s screen. The default color is white.

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

Example

Parameters

Description

color

Sets the pen color to:

  • red
  • green
  • blue
  • black
  • white
  • yellow
  • orange
  • purple
  • cyan
  • transparent

When started, sets the pen color to red and draws a rectangle with the top-left corner at (50, 50), width 130 pixels, and height 60 pixels.#
    when started
    [Draw a rectangle with an orange outline.]
    set pen / font color to [orange v] on screen
    draw rectangle [200] [150] [240] [150] on screen
    set pen / font color to [white v] on screen
    print [VEXcode AIR] at x: [250] y: [220] on screen

A screenshot of the VEX AIR Drone Controller's screen with a thin orange rectangle with the words VEXcode AIR printed in white in the center.

set text fill color#

The set text fill color block sets the highlight color used when text is printed. The default highlight color is transparent.

set fill color stack block#
    set text fill color to [red v] on screen

Parameters

Description

color

Sets the text highlight color to:

  • red
  • green
  • blue
  • black
  • white
  • yellow
  • orange
  • purple
  • cyan
  • transparent

Examples

When started, sets the fill color to orange and draws two rectangles. The first is at (50, 50), and the second is at (50, 130), both with a width of 100 pixels and a height of 60 pixels.#
    when started :: hat events
    [Display two colors behind text.]
    set text fill color to [red v] on screen
    print ["Red"] on screen ▶
    set cursor to next row on screen
    set text fill color to [blue v] on screen
    print ["Blue"] on screen ▶

set draw fill color#

The set draw fill color block sets the color used to fill shapes when they are drawn. The default fill color is black.

set fill color stack block#
    set draw fill color to [red v] on screen

Parameters

Description

color

Sets the shape fill color to:

  • red
  • green
  • blue
  • black
  • white
  • yellow
  • orange
  • purple
  • cyan
  • transparent

Examples

When started, sets the fill color to orange and draws two rectangles. The first is at (50, 50), and the second is at (50, 130), both with a width of 100 pixels and a height of 60 pixels.#
    when started
    [Draw an orange-filled rectangle with text on top.]
    set draw fill color to [orange v] on screen
    draw rectangle [200] [150] [240] [150] on screen
    print [VEXcode AIR] at x: [250] y: [220] on screen

A screenshot of the VEX AIR Drone Controller's screen with a solid orange rectangle with a thin white border with white text reading VEXcode AIR printed in the center.

Draw#

show image file#

The show image file block draws a custom user-uploaded image on the controller’s screen at the set origin.

show user image stack block#
    show image file [IMAGE1 v]

Parameters

Description

image number

The user-uploaded image to use. Options will change if image names are edited in the Control Panel.

Example

todo#
    when started
    [Display custom image on screen.]
    show image file [IMAGE1 v]

draw pixel#

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

draw pixel stack block#
    draw pixel [0] [0] on screen

Parameters

Description

x

The x coordinate to draw the pixel, ranging from 0 to 640.

y

The y coordinate to draw the pixel, ranging from 0 to 480.

Example

When started, draws a pixel at the center of the screen at coordinates (120, 120).#
    when started
    [Draw five pixels in a diagonal.]
    draw pixel [360] [200] on screen
    draw pixel [340] [220] on screen
    draw pixel [320] [240] on screen
    draw pixel [300] [260] on screen
    draw pixel [280] [280] on screen

A screenshot of the VEX AIR Drone Controller's screen with 5 evenly spaced pixels printed in a diagonal line across 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 stack block#
    draw line [0] [0] [10] [10] on screen

Parameters

Description

x1

The x coordinate in pixels of the start of the line, ranging from 0 to 640.

y1

The y coordinate in pixels of the start of the line, ranging from 0 to 480.

x2

The x coordinate in pixels of the end of the line, ranging from 0 to 640.

y2

The y coordinate in pixels of the end of the line, ranging from 0 to 480.

Example

When started, draws a diagonal line from the top-left corner (0,0) to the bottom-right corner (240,240) of the screen.#
    when started
    [Make an X across the screen.]
    draw line [0] [0] [640] [480] on screen
    set pen / font color to [cyan v] on screen
    draw line [0] [480] [640] [0] on screen

A screenshot of the VEX AIR Drone Controller's screen with a white line drawn from the upper left  to the lower right corner, and a teal colored line drawn from the lower left to upper right corner, intersecting in the center.

draw rectangle#

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

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

Example

Parameters

Description

x

The x coordinate in pixels of the top-left corner of the rectangle, ranging from 0 to 640.

y

The y coordinate in pixels of the top-left corner of the rectangle, ranging from 0 to 480.

width

The width of the rectangle in pixels.

height

The height of the rectangle in pixels.

When started, draws a rectangle on the screen with the top-left corner at (50,50), width of 130 pixels, and height of 60 pixels.#
    when started
    [Draw two rectangles on the screen.]
    draw rectangle [0] [0] [620] [460] on screen
    set fill color to [green v] on screen
    draw rectangle [200] [180] [200] [100] on screen

A screenshot of the VEX AIR Drone Controller's screen with a solid green rectangle with a thin white border printed in the center, and a thin white rectangle printed around the outer edges of the screen.

draw circle#

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

draw circle stack block#
    draw circle [0] [0] [10] on screen

Parameters

Description

x

The x coordinate in pixels of the center of the circle, ranging from 0 to 640.

y

The y coordinate in pixels of the center of the circle, ranging from 0 to 480.

radius

The radius of the circle in pixels.

Example

When started, draws a circle on the screen with the center at (120,120) and a radius of 40 pixels.#
    when started
    [Draw one green circle on the screen.]
    set fill color to [green v] on screen
    draw circle [320] [240] [200] on screen

A screenshot of the VEX AIR Drone Controller's screen with a large solid green circle with a thin white border drawn centered on the screen.

Touch#

screen pressed?#

The screen pressed? block reports if the controller’s screen is currently being pressed or not pressed. This block returns a Boolean value:

  • True - Screen is currently being pressed

  • False - Screen is not being pressed

screen pressed boolean block#
    <screen pressed?>

Parameters

Description

This block has no parameters.

Example

    when started
    [Play a sound when the screen is pressed.]
    forever
    if <screen pressed?> then
    play note [low v] [C v] [note_eight v] ▶
When the screen is pressed, the first message is shown. The code then waits until the screen is released, and only continues after the screen is pressed again to show the second message.#
    when started
    [Display different messages after the screen is pressed.]
    wait until <screen pressed?>
    print [First message!] on screen ▶
    set cursor to next row on screen
    [Lift finger to press the screen again.]
    wait until <not <screen pressed?>>
    wait until <screen pressed?>
    print [Second message!] on screen ▶

screen position#

The screen position block returns an integer showing the x- and y-coordinate (in pixels) where the screen was pressed. The return value for x is between 0 (left) and 640 (right). The return value for y is between 0 (top) and 480 (bottom).

A VEX AIR Drone Controller with the printable area of the screen dimensions labeled and outlined in a red box. The coordinates begin with (0,0) in the upper left corner, and proceed clockwise with (0, 640), (480, 640), and (480,0) to the lower left corner. The center coorindates of the scrren are labeled (240, 320).

screen position reporter block#
    (screen [x v] position)

Parameters

Description

coordinate

The coordinate of the last screen press in pixels:

  • x - The horizontal position
  • y - The vertical position

Example

When started, continuously checks for screen presses. If pressed, clears the screen and prints the x- and y-coordinates of the touch position.#
    when started
    [Play high or low note based on where screen is pressed.]
    forever
    if <screen pressed?> then
    if <(screen [x v] position) [math_greater_than v] [320]> then
    play note [high v] [C v] [note_eight v] ▶
    else
    play note [low v] [C v] [note_eight v] ▶

when screen event#

The when screen event block is called when the controller’s screen is pressed or released.

When screen event hat block#
    when screen [pressed v]

Parameters

Description

action

Determines when the attached stack of blocks will run:

  • pressed
  • released

Example

    when screen [pressed v]
    [Play a sound when the screen is pressed.]
    play sound [success v] ▶