屏幕#

介绍#

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.

打印#

set cursor to row column on screen#

When using the set cursor to row column on screen 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 on screen block positions the cursor based on row and column size, not font style. The font size can be adjusted using the set font on screen block.

设置游标堆栈块#
在屏幕上设定光标至 [1] 行 [1] 列

参数

描述

The row of the cursor as an integer.

柱子

The column of the cursor as an integer.

例子

当开始
[Repeatedly print the current timer at Row 1 Column 1]
永久循环
在屏幕上打印 (计时器秒数)◀ 并设定光标为下一行
等待 (1) 秒
清屏
在屏幕上设定光标至 (1) 行 (1) 列

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

set cursor to next row on screen#

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

在屏幕上设定光标至下一行

参数

描述

This block has no parameters.

例子

当开始
[Display two lines of text.]
在屏幕上打印 [Line 1]▶
在屏幕上设定光标至下一行
在屏幕上打印 [Line 2]◀ 并设定光标为下一行

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 on screen#

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

清除屏幕第 (1) 行

参数

描述

The row number to clear as an integer.

例子

当开始
[Display text on two rows, but only keep one.]
在屏幕上打印 [This text stays]◀ 并设定光标为下一行
在屏幕上打印 [This disappears]◀ 并设定光标为下一行
等待 (3) 秒
清除屏幕第 (2) 行

光标列#

光标列块返回将以整数形式打印文本的列号。

光标列报告块#
(光标列数)

参数

描述

This block has no parameters.

例子

启动时,将光标移动到屏幕上的第 3 行、第 2 列,并打印当前光标列号。#
当开始
[Display the cursor's current column.]
在屏幕上设定光标至 [3] 行 [2] 列
在屏幕上打印 (光标列数)▶

光标行#

cursor row 块返回将以整数形式打印文本的行号。

游标行报告块#
(光标行数)

参数

描述

This block has no parameters.

例子

启动后,将光标移动到屏幕上的第 6 行、第 2 列,并打印当前光标行号。#
当开始
[Display the cursor's current row.]
在屏幕上设定光标至 [3] 行 [2] 列
在屏幕上打印 (光标行数)▶

设置#

清除屏幕#

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

清屏

参数

描述

This block has no parameters.

例子

当开始
[Fill the screen, then clear it after 2 seconds.]
重复 (5)
在屏幕上打印 [Line]◀ 并设定光标为下一行
结束
等待 (3) 秒
清屏

set font on screen#

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

设定屏幕字体为 [等宽字体 v] [中 v]

参数

描述

字体

使用的字体:

  • 等宽字体
  • 比例字体

尺寸

使用的尺寸:

  • 特小
  • 特大
  • 超大

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

例子

当开始
[Display two different fonts on separate lines.]
设定屏幕字体为 [等宽字体 v] [中 v]
在屏幕上打印 [Mono Medium]◀ 并设定光标为下一行
设定屏幕字体为 [比例字体 v] [中 v]
在屏幕上打印 [Prop Medium]◀ 并设定光标为下一行

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.

在屏幕上设定打印精度为 [0.1 v]

参数

描述

精确

将打印精度设置为:

  • 1
  • 0.1
  • 0.01
  • 0.001
  • 所有数字

例子

当开始
[Print 1/3 as 0.33.]
在屏幕上设定打印精度为 [0.01 v]
在屏幕上打印 ([1] / [3])◀ 并设定光标为下一行

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

set pen width on screen#

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

设定屏幕笔宽为 [10]

参数

描述

宽度

笔的宽度(以像素为单位),范围从 0 到 32。

例子

当开始
[Draw two circles with different pen widths.]
在屏幕 (40) (70) (20) 上画圆形
设定屏幕笔宽为 (5)
在屏幕 (100) (70) (20) 上画圆形

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 / font color on screen#

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

设定屏幕笔/字体颜色为 [红色 v]

参数

描述

颜色

将笔颜色设置为:

  • 红色
  • 绿色
  • 蓝色
  • 白色
  • 黄色
  • 橙色
  • 紫色
  • 红紫色
  • 紫色
  • 蓝紫色
  • 蓝绿色
  • 黄绿色
  • 黄橙色
  • 红橙色

例子

当开始
[Draw two rectangles with different colors.]
在屏幕 (100) (50) (10) (20) 上画矩形
设定屏幕笔/字体颜色为 [蓝色 v]
在屏幕 (50) (50) (10) (20) 上画矩形

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 on screen#

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

设定屏幕填充色为 [红色 v]

参数

描述

颜色

将填充颜色设置为:

  • 红色
  • 绿色
  • 蓝色
  • 白色
  • 黄色
  • 橙色
  • 紫色
  • 红紫色
  • 紫色
  • 蓝紫色
  • 蓝绿色
  • 黄绿色
  • 黄橙色
  • 红橙色

例子

当开始
[Draw a yellow circle.]
设定屏幕填充色为 [yellow v]
在屏幕 (50) (50) (20) 上画圆形

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 pixel on screen#

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

在屏幕 [0] [0] 上画点

参数

描述

x

绘制像素的 x 坐标。

y

绘制像素的 y 坐标。

例子

当开始
[Draw one pixel at the center of the screen.]
在屏幕 (80) (50) 上画点

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

draw line on screen#

The draw line on screen 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.

在屏幕 [0] [0] [159] [107] 上画线段

参数

描述

x1

线起点的 x 坐标(以像素为单位)。

y1

线起点的 y 坐标(以像素为单位)。

x2

线末端的 x 坐标(以像素为单位)。

y2

线末端的 y 坐标(以像素为单位)。

例子

当开始
[Draw a line from the top left to bottom right of the screen.]
在屏幕 (0) (0) (159) (107) 上画线段

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 on screen#

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

在屏幕 [0] [0] [10] [10] 上画矩形

参数

描述

x

矩形左上角的 x 坐标(以像素为单位)。

y

矩形左上角的 y 坐标(以像素为单位)。

宽度

矩形的宽度(以像素为单位)。

高度

矩形的高度(以像素为单位)。

例子

当开始
[Draw a rectangle on the screen.]
在屏幕 (25) (25) (100) (50) 上画矩形

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

draw circle on screen#

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

在屏幕 [0] [0] [10] 上画圆形

参数

描述

x

圆心的 x 坐标(以像素为单位)。

y

圆心的 y 坐标(以像素为单位)。

半径

圆的半径(以像素为单位)。

例子

当开始
[Draw a circle on the screen.]
在屏幕 (80) (50) (20) 上画圆形

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