Touch LED#
Introduction#
The Touch LED category includes blocks that control and monitor the VEX IQ Touch LED. These blocks allow you to set color, brightness, and fade speed, as well as detect when the Touch LED is being pressed.
Below is a list of all blocks:
set Touch LED color — Sets the Touch LED to a selected color.
set Touch LED fade — Sets how quickly the Touch LED transitions between colors.
set Touch LED brightness — Sets the brightness level of the Touch LED.
Touch LED pressed? — Returns whether the Touch LED is currently being pressed.
when Touch LED — Executes the attached stack of blocks when the Touch LED is pressed or released.
set Touch LED color#
The set Touch LED color block sets the color of the Touch LED using the current transition speed and brightness settings.
设定 [TouchLED 1 v] 颜色为 (none v)
Parameters |
Description |
|---|---|
touch led |
Which Touch LED’s color to set, configured in the Devices window. |
color |
Sets the LED’s color to:
|
Example
当开始
[Blink the TouchLED off and on.]
永久循环
设定 [TouchLED 1 v] 颜色为 (green v)
等待 (0.5) 秒
设定 [TouchLED 1 v] 颜色为 (none v)
等待 (0.5) 秒
当开始
[See what color the Optical Sensor is detecting.]
永久循环
设定 [TouchLED 1 v] 颜色为 ([Optical 1 v] 颜色)
等待 (0.5) 秒
set Touch LED fade#
The set Touch LED fade block sets how fast the Touch LED will transition between colors.
设定 [TouchLED 1 v] 变色速度为 [slow v]
Parameters |
Description |
|---|---|
touch led |
Which Touch LED’s transition speed to set, configured in the Devices window. |
transition speed |
The speed at which the Touch LED will transition to the next color:
|
Example
当开始
[Slowly fade TouchLED colors.]
设定 [TouchLED 1 v] 颜色为 (green v)
设定 [TouchLED 1 v] 变色速度为 [slow v]
等待 (2) 秒
设定 [TouchLED 1 v] 颜色为 (red v)
set Touch LED brightness#
The set Touch LED brightness block sets the brightness of the Touch LED.
设定 [TouchLED 1 v] 亮度为 (50)%
Parameters |
Description |
|---|---|
touch led |
Which Touch LED’s brightness to set, configured in the Devices window. |
brightness |
The brightness of the Touch LED from 0 to 100 as a percent. |
Example
当开始
[Light up the TouchLED with different brightnesses.]
设定 [TouchLED 1 v] 亮度为 (25)%
设定 [TouchLED 1 v] 颜色为 (green v)
等待 (2) 秒
设定 [TouchLED 1 v] 亮度为 (100)%
Touch LED pressed?#
The Touch LED pressed? block returns a Boolean indicating if a Touch LED is currently being pressed.
True — The Touch LED is being pressed.
False — The Touch LED is not being pressed
<[TouchLED 1 v] 按下了?>
Parameters |
Description |
|---|---|
touch led |
Which Touch LED to check, configured in the Devices window. |
Example
当开始
[Change the TouchLED color when it is pressed.]
设定 [TouchLED 1 v] 颜色为 (green v)
等到 <[TouchLED 1 v] 按下了?>
设定 [TouchLED 1 v] 颜色为 (blue v)
when Touch LED#
The when Touch LED block runs the attached stack of blocks when the Touch LED is pressed or released.
当 [TouchLED 1 v] [pressed v]
Parameters |
Description |
|---|---|
touch led |
Which Touch LED to check, configured in the Devices window. |
actions |
Determines when the attached stack of blocks will execute:
|
Example
当 [TouchLED 1 v] [pressed v]
[Turn green briefly when pressed.]
设定 [TouchLED 1 v] 颜色为 (green v)
等待 [2] 秒
设定 [TouchLED 1 v] 颜色为 (none v)