The EV3 can display images and write text.
EV3 可以显示图像和写入文本。
You can display an image for a specified time duration. The following program displays neutral eyes for 2 seconds.
您可以在指定的持续时间内显示图像。以下程序显示中性眼睛 2 秒钟。
After 2 seconds the screen is cleared and becomes white. There is also an option for displaying an image continously, without erasing.
2 秒后,屏幕被清除并变为白色。还有一个选项可以连续显示图像,而不进行擦除。
There is a command to clear the screen.
有一个命令可以清除屏幕。
The command display for X seconds can be composed from:
X 秒的命令显示可以由以下部分组成:
You can use the 5 buttons to display eyes which look into the direction of the button. We start with a neutral position, and can return to that position with the center button.
您可以使用 5 个按钮来显示注视按钮方向的眼睛。我们从中立位置开始,然后可以通过中心按钮返回到该位置。
With the left/right buttons you can move the eyes to the left and to the right.
使用左/右按钮,您可以将眼睛向左和向右移动。
With the up/down buttons you can move the eyes up and down.
使用向上/向下按钮,您可以上下移动眼睛。
By displaying two images in repetition we can create a simple animation. The following loop displays two hearts, a small one and a larger one.
通过重复显示两个图像,我们可以创建一个简单的动画。下面的循环显示两个心,一个小的和一个较大的。
We define a variable time which we set to 0.5. Then we enter a forever loop where we:
我们定义了一个可变时间 ,并将其设置为 0.5。然后我们进入一个 forever 循环,其中我们:
The up/down buttons serve to change the time variable by increments of 0.1.
向上/向下按钮用于以 0.1 为增量更改时间变量。
You can write text to one of 12 lines. The following program sets the variable x to 1 and increases it to 12 in a loop, in order to write text on each line.
您可以将文本写入 12 行中的一行。下面的程序将变量 x 设置为 1 并在循环中将其增加到 12,以便在每一行上写入文本。
This is the result: 结果如下:
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
line 10
line 11
line 12
We also can slow it down and write line by line.
我们也可以放慢速度并逐行写入。
The following program uses two rotary encoders to write the letter x at position (x, y).
下面的程序使用两个旋转编码器在位置 (x, y) 写入字母 x。
It produces output like this:
它产生如下输出:
x=80
y=20
x
Sometimes it is useful to display multiple sensor values on the display. This program displays 4 sensor values on the first 4 lines.
有时,在显示屏上显示多个传感器值很有用。该程序在前 4 行显示 4 个传感器值。
It produces output like this:
它产生如下输出:
123
0
2
34.5
To better write this line of information we can define a function which:
为了更好地编写这行信息,我们可以定义一个函数,该函数:
Now we can display these values with an explanatory text (position, speed, etc.)
现在,我们可以用解释性文本(位置、速度等)来显示这些值。
It produces output like this:
它产生如下输出:
position = 123 speed = 0 color = 2 distance = 34.5
The status light around the buttons can be set to:
按钮周围的状态指示灯可以设置为:
It also can be set to flashing mode called:
它也可以设置为闪烁模式,称为: